VS 2008 Move Form From Module Sub?
Jun 7, 2009
I'm making a simple window that bounces around the screen (no reason, just for fun). I can make it work when the moving code is in a Timer_Tick event in the form, but now that I try to move it out to a module, it won't work. Here's what I have:
[Code]....
I try to call it with Bounce(Me) but the form doesn't move. I added a Debug.WriteLine(form.Location) at the end of the sub, and it shows that the location is not changing.
View 7 Replies
ADVERTISEMENT
May 4, 2009
I have a project that calls for just a ton of forms and I'd like them all centered on screen. Any way to call this in a module? Just trying to minimize the code necessary for each form. This is the basic centering I use now, only it's in each form_load.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xLoc As Integer = (Screen.PrimaryScreen.Bounds.Width - Me.Width) 2
Dim yLoc As Integer = (Screen.PrimaryScreen.Bounds.Height - Me.Height) 2
Me.Location = New Point(xLoc, yLoc)
End Sub
View 3 Replies
Aug 25, 2009
I have a Sub Routine in a module to iterate controls on a form. I get an error about an instance of the object not created.I have declared the object and set it to the form (ModelsBox = Me). I have done this between two forms previously. Is there something fundamental that I am missing. Is this where the "Friend Shared" comes into play?
[Code]...
View 2 Replies
Dec 16, 2010
I've been coding a Windows applicaton for the past seven months but there aren't a lot of "windows" in the application so I have a question on getting and returning data from forms. I display a form and the user makes a listbox selection then presses Ok. Normally I can proceed from there (in a class module) with values from the config file, but sometimes his selection will require me to ask for more information. So I want the class to display a form, pass control to it, then when the user hits OK on this form, return to the class. What is happening is the class continues with all its inline code and function calls and doesn't show the form until the end of its current function.
Dim flClientInputFile As New CFile
Dim flPreparedOutputFile As New CFile
Dim lRecordCount As Long
Dim sProcessing As String
Dim sTest As String
Dim frmAbc As New frmAbc
frmAbc.Show()
frmAbc.Activate()
x()
When I run and step through this code, I find I'm in x() before I even saw the form. x() needs the data the user has entered on frmAbc in order to continue.
View 2 Replies
Dec 6, 2009
I have a simple, but important question: How can I raise events of my form1 on another module/form?My form tempalte is crowded with events (50 of them contextmenustrip events)How can I place those events on another form/module to clean it up a little?
View 7 Replies
Jul 29, 2009
I have an MDI application which uses fixed sized forms. I've started to change the forms to sizeable and anchored the controls so they move when the form is resized. If the child form has a menu this jumps onto the parent menu (as it always has done) but all the controls move up the form at runtime and leave a space at the bottom of the child. If I change the form in design mode to cut through the bottom controls i.e. so the form doesn't appear tall enough, it corrects itself at runtime. Is there another workaround as it looks misleading in the designer.
View 3 Replies
Oct 21, 2010
What I'd like to do is in my application move a control like a groupbox or frame with content on it from e.g the main form to a tabpage on that same main form using code.
I can change the position of the control using it's location, but I haven't got a clue on how to move it from the main form to a tabpage, or from 1 tabpage to another.
-Is this at all possible and if so, how can it be achieved?
View 2 Replies
Oct 5, 2010
I'm trying to figure out the best way to reference a control on a form from within a module. Unfortunately the form is just an instance, so it's not as easy as calling form.control...
Dim ChildForm As New frmSearch
' Make it a child of this MDI form before showing it. '
ChildForm.MdiParent = Me
ChildForm.Show()
That form has an option for printing, which calls another form where certain options are chosen. The print form in turn calls a function in a module, which tries to reference back to the origional form.
childform as new frmSearch -> frmPrintForm -> sub okToPrint (in module Print)
okToPrint tries to reference a listview on frmSearch, but can't find it.
For Each itmX In frmSearch.lstResults.Items
So the solutions I can think of off the top of my head are:
1. Somehow divine which form is the caller of frmPrintForm
2. Pass ChildForm to the frmPrintForm as a variable to be passed on to module Print..
3. Use frmSearch directly instead of using an instance of it.
Number 1 would be my preference, as I don't want to have to pass forms around like that.
View 4 Replies
Aug 5, 2010
i have my main child form open. then i show the new form:
[Code]...
but when the form opens it flickers a lot. so i want move the new form behind the main form while it loads so the user does not see the flicker. once it is done loading i will set the form to topmost. how do i move the new form behind the main form?
View 12 Replies
Sep 3, 2010
What does this error mean? I havent modified anything in the designer code, but its giving me an error? WithEvents variable 'Move' conflicts with event 'Move' in the base class 'Control' and should be declared 'Shadows'. The error relates to Friend WithEvents Move As System.Windows.Forms.DataGridViewCheckBoxColumn
View 1 Replies
Jun 18, 2012
I have a connection module in which I have written the open and close database connection.... if database connection is an error it will return false else if success it will return true the function of the modules will be called from the form code....
what I need is if the connection is an error the module should also get the form name which returned the error...is it possible???
check my below code....
DBConnection.module
Imports System.Data.SqlClient
Module DBConnection
[Code].....
now what I need is if the functions Open_DB_Connection() or Close_DB_Connection() returns error it should prompt the form name....
View 4 Replies
Sep 16, 2009
i am asking about using the progress bar into the status bar to move when i load any child form inside the MDIParent form.
View 1 Replies
Mar 23, 2011
well i successfully docked a perpixel alpha form with the main form(form1). but the perpixel alpha form always appears at the top left corner of the screen and when i move the main form the form(perpixel alpha form) inside it dosen't move it stays at the top left corner. ALWAYS. to dock the perpixel alpha form i used
Me.toplevel = false
Me.parent = form1
View 6 Replies
Mar 22, 2012
What is the best way to resize & move a form using just VB commands? I have a form that I need to set the Height and Top props, problem is that takes two calls and there is a noticable flicker. I tried using SuspendLayout/ResumeLayout, DoubleBuffered, swaping the top and height calls around, etc, but nothing seems to help. The test forms only have one small listview and one or two buttons. [Code]
View 2 Replies
Jun 20, 2012
I recently have convert my project from VB6 to VB.NET2008,after the convert here is a sub that control form from a module that i create,the error was something like
"cmdAdd is not a member of System.Windows.Forms.Form"
Public Sub ButtonSet(ByRef frmObj As System.Windows.Forms.Form)
frmObj.cmdAdd.Visible = True
frmObj.cmdCopy.Visible = True
frmObj.cmdEdit.Visible = True
[Code]...
View 1 Replies
Jul 14, 2009
How can I edit my a form through a module? I am using this code in the module.
Here is where I get an error: Private Sub ExtendedWebBrowser_NewWindowExtended(ByVal sender As Object, ByVal e As WebBrowserNewWindowExtendedEventArgs) Handles Me.NewWindowExtended Button1.Text = "New window event just triggered!"End Sub
The code editor will not recognize when I type Form1, and I obtain the following error when I manually type it:form1' is not declared.I sense there is something I can do here which is very easy to fix this, but I have not worked much with Classes before.
View 2 Replies
Jul 22, 2011
he form has a listview control. The form call a function stored in a module VB file. In the function, I will do something. I want to add a monitor in the function. When finish somethings, the function will add some message to the
View 1 Replies
Nov 21, 2010
I am writing a program in VB2010 Express that handles serial port communication. All subs and functions that handle writing to, and reading from the serial port are in a module. These subs and functions are typically called from a form, e.g. by pressing a button. The command is then sent to a device attached to the serial port, and this device replies with a number of bytes as a result. A 'ReceivedDataHandler' is used to handle the serialport.datareceived event. [code]....
View 6 Replies
Dec 14, 2011
I have a form. The form has a listview control. The form call a function stored in a module VB file. In the function, I will do something. I want to add a monitor in the function. When finish somethings, the function will add some message to the listview. I add the form.refresh event at the after listview add item coding. But, it doesn't work.
View 6 Replies
Sep 17, 2009
Just want to ask something, how can i show form in my Module?
View 2 Replies
Jul 4, 2009
How to add Module to Form in VB 2005?
View 2 Replies
Jun 30, 2009
I have one form lays on the top of a form or a panel. I would like be able to drag the top form within the boundary of the bottom form or panel. How can I do that?
View 4 Replies
Apr 23, 2011
How do I do something like this.[code]...
This is inside the Module separate from Form1 class as you can see right off the bat it's not a class and there is no reference to Form1.. how do I access Form1 without passing reference to make factory modules work like this.
View 1 Replies
Jun 20, 2011
i've created a Sub in a Form.
I've created another Sub in a module.
I call the Sub in the module from the form, passing the form into the Sub defined in the module.
Then i add an Handler to an istance of a control (for example mousemove) and i want to give to this handler the execution of the Sub defined in the form.
Example.
Class form1
Sub Form1Sub()
ModuleSub(me)
[Code]....
The problem is that i don't know hot to call the Sub defined in the form, in the Sub handler using the istance of the form passed in the Sub paramenter in the module...
View 7 Replies
Jul 23, 2009
I have a main form (frmPos) and through a module (modTransaction) I open and close several other forms. This works flawlessly. However, when the function on the module is finalized, I want to clear the main (open) form. Therefore, I made a public sub (clearForm) on the main form and when I call this from the main form it works.
View 2 Replies
May 9, 2009
I wonder how do I delete a Module or Class or a Form.[code]...
View 10 Replies
Dec 15, 2011
I tried to access a variable using a module with this code:
Module DataModule
Public x As Integer = form1.trackbar.value
nd Module
View 11 Replies
Jun 22, 2010
i am trying to create a simple game as homework from my school. now i just stuck on one stage. see the picture on this link how it looks like.[URL]
i have created a module here is the code for module file
Module Module1
Public Sub bknapper()
'create button on fly
[Code].....
View 6 Replies
Nov 17, 2009
I have a situation where I need to display a Modal Window from a vb.net module and feed the contents to that modal form from the module.I am showing the form , feeding data to it from a class module and trapping the events in it using a timer control from the module.It works fine with Show() method but it doesn't with ShowDialog().If I used ShowDialog() then I was not able to continue with the code followed by it and not able to update any contents in the modal form.
I am using VS2003 version.Is there any workaround to this?
View 1 Replies
Feb 9, 2009
I have two forms . each form has a text box. if i type something in first text box, and click next button, it has to show up on the second text box which is on the second form. how would i code this, or how can i use a module?
View 5 Replies