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


ADVERTISEMENT

VS 2008 Calling Form Controls From Module?

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

IDE :: How To Calling Form Object Public Function From A Module

Apr 5, 2010

I am using VB2008 In the Form1, i have coded

Public Function getText(ByRef ctlName As String) As String

getText = Mfg.get_TextMatrix(Mfg.Row,Mfg.Col

[Code]...

View 5 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

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

Calling A Function From Another Module?

Sep 24, 2010

I have an 100 aspx files with one module file for code. All these aspx files have the same backend function, so i created on public module for all these files to access. These files are in the same folder. But for some reason the aspx files cannot access the function from that module.

mod1.vb Code (.vb file)
Public Module Allinone
Sub Allinone_Load(ByRef Page As Web.UI.Page)

[Code]....

I am at a roadblock of why the aspx files wont read this module? Also all these files are in the same directory

View 1 Replies

Calling Function With Same Name As Module?

Sep 29, 2009

I have a console application consisting of two modules. One module named "quote" is the main module for the application. Another module named "common" contains commonly used functions and subroutines that are shared between multiple applications.

In the "common" module is a function named "quote". If I attempt to call the "quote" function from the module named "quote", then I get the following error: Error 1 'quote' is a type and cannot be used as an expression. However, if I copy the quote function from the "common" module to the "quote" module, then I no longer receive this error.

There shouldn't be an issue with calling a function that happens to have the same name as a module, but only when that function is located in a different module.

View 2 Replies

Asp.net - Calling A Shared Procedure From A Module?

Aug 6, 2011

I would love to use the following procedure to set the Title, keywords etc. of my pages, in a module.

Public Shared Sub SetTitle(ByVal Heading As String, ByVal Keywords As String())
Dim myMaster As Masterpage = DirectCast(Me.Master, Masterpage)
If Request.QueryString("lng") = "es" Then

[Code]....

The problem is that i get two errors.

At Me.Master i get the 'Me' is valid only within an instance method. error and at

If Request... i get the error

Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

So how do i fix these? I would like to have that procedure in a common place and not in every page.

View 1 Replies

Calling A Webpage From Within A Class Module?

Jun 1, 2009

I have been given an ASP.Net assignment at work because I had taken a few courses a couple of years ago. Currently, there are no ASP.Net programmers for me to ask here and I have searched several places (including Pro ASP Net book) to find a solution but have come up empty handed.

I have a class named spErrors which takes the values passed to it. Values passed include the offending page,function/sub, and other values and stores them in property values, then calls Response.Redirect("Errors.aspx") from the page's code behind page. In Errors.aspx, the values of the error/exception trapped in the Catch statement are displayed. This works fine from a web form. My question is, how do I call a web page from a class module?

Each class module has the ErrorHandler() procedure that passes these values to the class object. In the class, there is a Write Only property named Redirect and a method called Execute() which is used to display the error page if the error occurs in another class module. Since Response.Redirect() does not work in a class module, what namespace is needed in order for this to work?

Here is the code I'm using.

In the Catch block.
Catch ex As Exception
Err.Description = ex.Message
ErrorHandler(Err, "function name")

[code]....

View 2 Replies

Calling Module When Textbox Focus

Dec 15, 2011

I am developing a VB net application with lots of TextBox. I need to call a module everytime any of the textbox gets focus. I dont want to write code in every textbox gotfocus event, but a generic code which will call the module everytime any textbox gets focus.

View 6 Replies

Calling A Function That's In A Module In External Application

May 25, 2012

I have an application (app.exe) that has a VB Module in its source code (Module1). The module has a function called Function1. I need to call this function from another application. The module is not marked as public, so adding a reference to app.exe won't work. I'm trying to use reflection (Assembly.LoadFrom()) but unless I'm way off base, the module would have to be a class in order for me to get an instance of it.

Please nobody ask me "what have you tried?" I tried a million different things and let's just say "none of them work." So I'm looking for someone that has specific experience with doing exactly what I'm trying to do. If you don't have that experience, please move on to the next question and ignore mine.

View 1 Replies

VS 2008 Calling Function Inside A Module -> InvalidOperationException Occurred?

May 13, 2009

I have a module1.vb that contains a public sub, for example

Public Sub LogEvent(ByVal strIn As String)
Dim objLogFile As Object
objLogFile = frmEventLog.txtLog

[code].....

View 15 Replies

Calling Events Of Controls?

Aug 9, 2010

I have combobox and I was wondering how do I call one of its events, for example,MyComboBox5_SelectedIndexChanged. I have no idea what to put in for its sender and e arguments.In other words; how do I complete the following statement

View 4 Replies

.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

Calling Showdialog() On A Form - From The Main Form's OnLoad Event Makes The Modal Dialog Go Away After A Few Seconds?

Aug 7, 2009

I'm having an interesting issue that I can't reproduce on a different project, but can consistently on this one. I have no clue what might be causing it, but am hoping that someone may have seen it before.

I have a main form, from which I run a series of checks. On this form, I have a listview control. Because of some issues with the refreshing of this listview control, I had to create my own messagebox. It's just a form that displays some text ( it also happens to look nicer than MsgBox; in my opinion, anyways ). It's been working great for months, until recently.

My problem is that on my main form's load event, I run this check, which returns an error within a try/catch block. I then call my custom messagebox with a message. It in turns calls it's ShowDialog() function.

In any other situation ( after the main form has been loaded ), I have no problems. The messagebox goes on the screen and behaves appropriately ( ie: waits for my input and acts as a modal dialog ( stops execution of my main form's thread ) ). However, on this onload event, my messagebox comes up and goes away almost immediately afterwards.

I've traced it all the way to the showdialog() call. For no explicable reason, it appears to skip right over this call, without me doing anything on the form.

Here's what the inner trace looks like ( when I put a breakpoint on the onclosing event for this messagebox form ):

CODE:

View 10 Replies

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

Set Calling FORM Visible = False By CALLED FORM

Sep 6, 2010

Requested were made by Businese Analyst to set the few Main FORMs VISIBLE PROPERTY TO FALSE when the POPUP FORM is loaded.

[Code].....

When the MAIN FORM loads the POPUP FORM, on the FRMPOPUPCUSTOMER-FORMLOAD even, it has to set the MAIN FORM Visible to False.

When FRMPOPUPCUSTOMER FORM IS UNLOAD it has to set the MAIN FORM Visible = TRUE.

How to the coding is to ensure that different MAIN FORM when loaded FRMPOPUPCUSTOMER it will turn the MAIN FORM Visible to FALSE.

View 2 Replies

Add Controls To A Form In Code And Set The Properties Of The Controls?

May 24, 2009

How can I add controls to a form in code and set the properties of the controls using the With statement?Also I would like to know how to add a container control and then add a control to that container.

View 2 Replies

Controls Not Return All The Child Controls For The Form?

Apr 15, 2010

I have a slight problem With an enumaration of child controls on a form. The following code will not get but about have the controls that are on the form. The controls show that the count is correct but when it goes through the loop it skips over some of the controls. If you run it through the enumeration two or three times it will get all the controls a few at a time. The solution uses two forms, one that has the controls and the other that labels are made and displayed on. The Tx is just a index to add a number to the label.name and rename the label. So each label is identified seperately. This works for all the the controls that are seen in the for each loop.

View 11 Replies

Pass Usercontrol Controls Or Form Controls?

May 11, 2009

I created a class that can take either usercontrol.controls or form.controls as a parameter,how can i pass either to that class? as a property or how?

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

Forms :: Calling A Function From A Form To Another Form?

Jul 22, 2009

how to call a function from a different form. Like the button click event. i have this scenario. I have a main form and a child form in the main form there is a navigation panel on the left side controlling the child form. What i want is if clicking the add record in my navigation panel will call a function in the child form to execute.

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







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