Get Form Name In Other Module?

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


ADVERTISEMENT

.net - Finding Out Which Instance Of A Form Initiated Another Form Or Module

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

Control Form From Module?

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

Editing A Form Through A Module?

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

How To Refersh A Form From Module

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

Notify A Form Sub From Module?

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

Refersh A Form From Module?

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

Show Form In Module?

Sep 17, 2009

Just want to ask something, how can i show form in my Module?

View 2 Replies

VS 2005 - How To Add Module To Form

Jul 4, 2009

How to add Module to Form in VB 2005?

View 2 Replies

Access Form Controls From Module?

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

Call A Sub Defined In A Form From A Module?

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

Call Sub On Open Form Through Module?

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

Delete A Module , Class / Form?

May 9, 2009

I wonder how do I delete a Module or Class or a Form.[code]...

View 10 Replies

How To Access Variable In A Different Form Using A Module

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

How To Reload Method Form Module

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

IDE :: Controlling A Modal Form From A Module?

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

Module - Two Forms . Each Form Has A Text Box

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

Module Cannot Access FORM Controls

Sep 16, 2011

I have a form called form1 which has a thread that runs a sub from a module.[code]...

Well from the module, there's a part where I have to update controls on the form1. Whenever I try doing it, it updates the value, but not the design. For example I write a delegate which makes label1.text = "111", while debugging, label1.text becomes 111, but it does not show it updated on the form design, it just stays at its default value.

View 4 Replies

Open Form From Console Module?

Aug 24, 2011

I am working on a chat program and I'm am trying to combine 2 projects into one solution. I have a console project and a win form project. So my question is how do you open or show a form from a console module?

View 1 Replies

Reference The Errorprovider On Another Form From A Module?

Aug 27, 2010

How can I reference the errorprovider on another form from a module.

Sample Code:

Sub
leaveOptionalTBTextValidation(ByRef TBControl
As custTextBoxControl,
ByRef intMaxChars

[Code].....

View 5 Replies

Run A Module In A Form Using A Click Event?

Sep 23, 2009

Is there a way to run a module in a form using a click event? I am trying to setup a easy user interface where when a button is clicked a module will run and generate information in a table.

View 3 Replies

VS 02/03 Calling A Form's Controls From A Module

Jun 10, 2011

I'm writing a program in vb.net 2003 and have come up with a problem.

I have a sub SettingsSave() in a module.

Public Sub SettingsSave()
Dim frmSaveSettings As New frmSettings
MsgBox frmSaveSettings.txtName.Value 'for testing purposes
SaveSetting("MyApp", "configs", "Name",frmSaveSettings.txtName.Value)
SaveSetting("MyApp", "configs", "Pass",frmSaveSettings.txtPass.Value)
End Sub

I have a form frmSettings, which has a button btnSave. When the button is clicked, SettingsSave() is called.The problem is, if btnSave is clicked, then either of the two textbox values are changed, then btnSave is clicked again, the SettingsSave() sub still returns the 'old' values (from the first time the save button was clicked).How do I clear the old values from memory? I've tried adding frmSaveSettings = Nothing, and frmSaveSettings.Close at the end of the sub SettingsSave().

View 5 Replies

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

VS 2010 - Add A Label To A Form (from A Sub In A Module)?

Aug 18, 2011

I'm trying to write a sub that when sent a form (if its needed) will create a label on that form. This is because all of the forms will have the same title label. My problem is that, basically, I have no idea how to do this. I also can't get labels to create when the code is written into the form itself; I tried:

[Code]....

View 3 Replies

[2005] Form Gradient From Module

Feb 14, 2009

I am trying to setup a public sub that allows me to customize the look of all forms when they load up. Only thing is, I am now trying to gradient a form and I am getting an error message as follows:

Quote: bounds is not a member of system.windows.form.painteventargs

The next post is my module code and this is how I am calling it

vb
Private Sub frmChangePassword_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'add some text to the title bar

[Code]......

View 1 Replies

Addressing And Reading A Control On A Form From A Module

May 7, 2012

I simply cannot refer to a control on a form from module code as in all other versions of VB. Here is the code that I mean:[code]The fact that this cannot seemingly be done without getting into looping through an array of controls, assigning the control to a general control variable etc. and much more guff is puzzling and is in my opinion an added complexity to Visual Basic. There must be a simple way to do this - I just want to refer to the value in a control, on a form, from a module.

View 13 Replies

Disable Module Or Sounds In Form Temporarily?

Feb 22, 2011

How can I disable temporarily a module ? If it cant then how can I disable the sounds of my form? I have a mouseover, hover and click event sound in my form and I want it to be disabled in my options. I make a module thinking that if I can disable my module but the use of a checkbox then it might work but if it will not the how can I do that? im thinking also of a simple if statement but I prefer simplier ones like disabling my module.

View 3 Replies

IDE :: Sort The Event Handlers Within A Module/Form By Name?

Feb 25, 2011

Is thier a way to sort the event handlers within a module/class/form Etc? The IDE add the next event handler and the end while I would like it to put it in place. For example I have already write some event handlers for a textbox named txtEmpname and I have another text box named txtphone. they are ordered in the module in the order created.(i.e. the txtempname_Gotfocus then the lostfocus, then txtphone_gotfocus) Now when I want to add a clcik event for the txtempname the IDE put it at the end while I would like it to put it just before the txtempname_gotfocus.

View 2 Replies

Implement A Time Delay In A Module, Outside A Form?

May 15, 2011

I'm working on a Windows Forms application with a module, and I want to put a time delay in the module rather than a form.

View 3 Replies

Public Module Updating Form Object?

Dec 1, 2009

I'm working on a project for my VB class at school. I am creating a form with several inputs and it calculates the total amount owed for a car sale. I have a text box for input of the TRADE IN VALUE of a car. the program is looking for a numeric input. If there is no trade in, how can i get this box to default to 0.00 so it doesnt error the program?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved