Using A Variable That Reside On Another Form?

Aug 27, 2011

Is it possible to use a Variable that reside on another Form?

View 5 Replies


ADVERTISEMENT

Reference The Values From Textboxes On Form Submit That Reside In Usercontrol?

Aug 18, 2011

I have a large form that reuses several elements, so I decided to create a usercontrol with some common fields. The problem is when the form is filled out by a user and submitted, how do I reference those values so I can input them to my database???

Example:

Using Conn As New SqlConnection(connect)
Using Cmd As New SqlCommand(SQL, Conn)
Cmd.Parameters.AddWithValue("@Acct_Company", txtPartner.Text)
Cmd.Parameters.AddWithValue("@Acct_AccountNum", txtPartnerAccount.Text)

So, above two Cmd lines are for normally inserted textboxes in my form, but what would the line look like to reference any usercontrol form fields?

View 1 Replies

Namespace Does The Month() Function Reside In

Mar 26, 2010

I'm not at all familiar with VB but do occasionally use C#. Really, i'm a BI guy who uses T-SQL on a daily basis in SSRS, which is why I have a question.I have a scenario where i've built a series of charts in SSRS 2008. Unfortunately, the functions available to me in SSRS are not enough for what I need my charts to do so I have decided to build my own function in embedded code. In SSRS, only VB.NET can be used when writing embedded functions.

I have opened Visual Studio 2008 Pro, created a solution and started building my function in Visual Basic 2008. So far, all is going well - i'm accepting a parameter which contains a string "date" of JAN-10, doing a substring operation on it to parse out the month and year, concatenating "20" to the two-digit year portion to get the full year. This part all works just fine.

For the three-letter month portion, i'm trying to use the MONTH() function to return it as an integer but unfortunatley it does not seem to be availble to me in Intellisense, which of course probably means i'm not accessing the class correctly. The odd thing is that the MonthName() function is available, but of course I can't use this with string values like "JAN" or "FEB" because it only accepts an integer. I'm familiar with the fact that in C# I can add a USING statement to the top of my class file to access a namespace, but i'm not sure how it works in Visual Basic 2008 because i'm honestly never used it before.

So my question - and this is probably a very basic question here - how do I access the Month() function? Which class or namespace (or both) do I have to reference in order to use it?Below is a screenshot of what I have so far, you can see from the Intellisense menu that the Month() function is not available:

[Code]...

View 3 Replies

Pass A Variable To Another Form Or Else Make The Variable Visible To Both Forms?

Sep 5, 2010

Using Visual Basic 2008 Express. I need to pass a variable to another form. Or else make the variable visible to both forms.

View 4 Replies

Use File To Converts Name As Defa And Where The Converted File Will Reside Same Dir As Original File?

Dec 23, 2010

I have an app I created in Vb2010 (my 3rd VbApp) it is a file converter which works but all it does after convert is... I have a converted file but no file name plus it converts within its own directory as opposed to convert in dir where original file location.

So any clues as to how I always use file to converts name as defa and where the converted file will reside same dir as original file?

View 2 Replies

VS 2008 Pass A Variable From One Form To Another Form's Timer In VB?

Jun 10, 2011

I have one form, which the user enters upto 5 websites then clicks go - I have on the second form, the one with the webbrowser. timer which checks if the web browser is busy then either a green light or black image will be shown along side the assocaited input box on the first form. I am finding it impossible to feed variables into the clock through ByVal, like I would a subroutine or function.

[Code]...

View 4 Replies

VS 2008 Pass Variable From Form To Form?

Aug 26, 2009

Is it possible to pass a variable set in one form to another?

View 12 Replies

Transferring Variable From One Form To Another Form?

May 1, 2010

I was able to pass my calculation from Form 1 to be used in another calculation in Form2.

Module1
Public ECC
As

[code].....

View 3 Replies

Variable From One Form To Another?

Jan 16, 2009

Say I set a variable on form1 like this:

Dim thisVariable as String

Then I want to use it on form2. How can I do that?

View 6 Replies

Get Variable From Another Form?

Apr 21, 2012

I have this on my main window

vb.net Public GameDate As New DateTime(1970, 1, 1)

And upon a button click I create a new instance of another form in my project.

[Code]...

View 15 Replies

Have A Variable Taken From One Form To The Other

May 8, 2011

I'm making a VB app which has two forms, a main form, and an options menu. How can I take a integer variable from one form (the options form) to the main form. I have tried one or two ways, but so far, nothing.

View 10 Replies

Using A Variable From One Form To Another?

Jul 7, 2009

In my application, I have two forms, and two corresponding *.vb files for the source code of the forms.I have a string of arrays in the main form declared in it's .vb file. The other form, I want to make it fill that array.I tried the "Public strVar(0 to 99) As String", but even with that my other form's .vb file does not recognize it. how do I declare a variable that can be used by all forms?

View 4 Replies

VS 2008 Error: Range Variable 'sender' Hides A Variable In An Enclosing Block Or A Range Variable Previously Defined In The Query Expression

Mar 25, 2010

I am getting the error:"Range variable 'sender' hides a variable in an enclosing block or a range variable previously defined in the query expression."for this

Imports System.Data.SqlClient
Imports System.Linq
Public Class Form1

[code]....

I can select any other item from the table without the error. "sender" has the same properties as "receiver" in the SQL table.

View 2 Replies

Calling Form-name By Variable?

Jun 25, 2010

i am currently trying to re-write an old VB6 program into .net basically the program contains 100's of forms for different jobs each with a Public Sub runjob(). the form names are then stored on a database. the user then selects the job from the listbox and it calls the correct job.the code i use to use in vb6 was

sValue = database.rsselectjobrun.Fields("callname")
Set frmName = Forms.Add(sValue)
frmName.runjob

Set frmName = Nothing i have looked into it and found this code which calls the form in .net

Dim objForm As Form
Dim sValue As String
Dim FullTypeName As String

[code]....

but i cannot get this to run anything other then the formload code. i know i can put all of this into a select case module but id rather not with the amount of forms i would have.

View 4 Replies

Declaring A Variable For Form And Using It?

Feb 8, 2010

I have declared this variable in a module : Public GenericForm As System.Windows.Forms.Form

and then through code I can asign to that variable a specific form .For example GenericForm = Form1. Then I can use that variable to handle that specific form , for example :

GenericForm.Show

My problem begins when I want to handle a control on that form , for example :

GenericForm.TextBox1.Text = "aaa"

This code creates an error reading :TextBox1 is not a member of System.Windows.Forms.Form.I have been using code like this in VB6 and was quite useful ,but now in VB .NET I cannot .You see I have many forms on which there are some text boxes with the same name,so I declare a generic variable as Form and accordingly insert the code the desired text box conform the form I wish each time . Can I do this in VB .NET too ?

View 23 Replies

Passing Whole Form As Variable

Jan 15, 2010

I know in VBA you could pass an entire form as a varible. Since using global variables are not advised in .net 2008, is there anyway to do this ?

View 9 Replies

Reference A Form From A Variable?

Nov 24, 2009

I am upgrading a very large project from VB6 to VS2008. I have several forms with dozens of combo boxes on each form. I use the same combo box names for each form and want to fill them from a module with different items depending upon the calling form. In VB6, I dimensioned a public variable - FormName as object and called Set FormName = frmMyForm1 on Form Load. In a module, I was able to write the following code:

With FormName
.combobox1.additem("item")
.combobox2.additem("item"
End With

I cannot make this work in VB.Net. When the form loads I call FormName = Me. If I dimension Friend FormName as Object, I get the error message that Public member combobox1 on type MyForm1 not found. If you are attempting to access members on a late-bound object make sure it is declared public". If I dimension Friend FormName as Form, I get an error that says "combobox1 is not a member of System.Windows.Forms.Form".

I have tried both CType and DirectCast to convert the form variable from Object to Form with no success. I also tried creating a public array and storing each form name in it.

View 4 Replies

Transfer A Variable From One Form To Another

Feb 7, 2010

How Do I Transfer A Variable From One Form To Another? I'm trying to transfer an integer variable and an array of string from my main form to my other form, how do I do it? So far I've been trying with functions but it won't work here's my code for the first form: [Code]

View 1 Replies

Transfer Value Of A Variable Into Another Form?

Jun 23, 2010

I want to transfr the values of 1 variable to another form i have tried declaring it public in module and still its getting the value 0.. my code is similar to this one..i have a variable mult in form 1 and it is storing the value of a * b a and b are getting values form user through text box..

mult = a * b

now i want the value of mult in form 2..

View 7 Replies

VS 2005 - Variable From One Form To Another

Jan 3, 2011

I have two forms and I need to take the values from the first form and add them to the second form. I have tried many things and nothing is being added or changed yet on the second form. The second form has a Panel as a background, then a GroupBox to group items together and then the relevant controls themselves. I have been working at this for the last few hours and not getting anywhere and needs a second pair of eyes.

I have tried DirectCast() and it doesnt work. Nothing happens. The data isnt added or the control selection isnt changed. No errors either. I have tried Me.ControlName.Property = FormName.ControlName.Property and it doesn't work. Nothing happens. The data isnt added or the control selection isnt changed. No errors either. [Code]

View 22 Replies

VS 2005 Variable From One Form To Another?

Feb 28, 2011

I have two forms and I need to take the values from the first form and add them to the second form. I have tried many things and nothing is being added or changed yet on the second form. The second form has a Panel as a background, then a GroupBox to group items together and then the relevant controls themselves.I have been working at this for the last few hours and not getting anywhere and needs a second pair of eyes.I have tried DirectCast() and it doesnt work. Nothing happens.The data isnt added or the control selection isnt changed. No errors either.I have tried Me.ControlName.Property =FormName.ControlName.Property and it doesnt work. Nothing happens. The data isnt added or the control selection isnt changed. No errors either.Screen shots attached and so is my code.Button Click

vb
Private Sub cmdStartClientSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStartWorkLogEntry.Click

[code]......

View 1 Replies

VS 2010 Form Name In Variable?

Sep 23, 2010

I have an apllication with many many distinct forms.

So, I need sometimes open a form, wich the name is strored in one variable

For example I have this:

dim aaa as string
aaa="frmTestForm"
I wanna open the form who have the name keepted in aaa.
Something like this:
[aaa].show()

View 7 Replies

Calling A Value From A Grid To A Variable In Another Form

Oct 8, 2009

I have datagrid in which the 0th column has ID. What i want is while clicking on the datagrid the id of the particular row has to be load in the variable in the second form. For this i have created a public variable in the second form [code]but here its not returning any value to EditID while loading the second form.

View 1 Replies

Copy A Form Object To A Variable?

Jan 8, 2009

Is there any method or a way to copy a form object to a variable? Let me explain this - We have a method called "Copy" for the Dataset class & you all must be knowing that there is a difference between the below two lines of code: DsTemp = Ds DsTemp = Ds.Copy()

In the first line of code, any changes made to Ds will reflect in DsTemp. However, in the second line of code, any changes made to Ds will not reflect in DsTemp because we are only "copying" the contents & schema of Ds. Likewise is there a method or a work around to "copy" a Form object?

[Code]...

View 11 Replies

Declaring A Variable TableAdapter On A Form

Aug 15, 2011

I am building a generic search form in my application. This will allow the user to search for various records throughout the application. The one thing I cannot seem to figure out is how to allow the declaration of the TableAdapter to change at run-time. Each part of the app will be passing a variable to the search form to specify which table should be loaded. In the form class I have the following:

FRIEND WITHEVENTS tbaSearchData AS database.databaseTableAdapters.TableOneTableAdapter This is great for TableOne. But, I have about a hundred tables that could be searched through. To load the data I'm using a DataGridView and populating it via a private method.

View 2 Replies

Forms :: Can't Pass Variable From One Form To Another?

Jun 8, 2011

I have one form, which the user enters upto 5 websites then clicks go - I have on the second form, the one with the webbrowser. A timer which checks if the web browser is busy then either a green light or black image will be shown along side the assocaited input box on the first form.I am finding it impossible to feed variables into the clock through ByVal, like I would a subroutine or function.

Private Sub ActiveMe_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ActiveMe.Tick
If ((WebBrowser1.IsBusy)) Then
Hey.BackColor = Color.Black[code]....

'Error message says Hey is not declared, as i can't pass it through to timer

The variable Hey is determined by the first form - Which picturebox.I have an if statement which simply says if inputbox one has url enter then Hey = Picturebox1, If input box2 has url entered then Hey= Picturebox2 etc.What I want is the timer to check the page has completed loading or is still loading or refresing and the appropriate green or black to be shown aside url input box on first form.I considered using a sub or procedure to act as a clock (a large for loop with another for loop within it, acting as a delay). But found this slowed down theapp to the point of crashing it.

View 1 Replies

Forms :: Carrying A Variable To Another Form?

Sep 3, 2010

I have the following form: Imports System.Data.SqlClient Public Class Form1 Dim ReturnValue As Object = Nothing

[Code]...

View 12 Replies

Forms :: How To Pass Variable From One Form To Another

Jul 17, 2010

I want to pass variables from one form to an other. The variables i I need in the second form( called" Hulsview") are :" hulsbreedte" and" hulslengte". To check if the varibles are passed I added a textbox in the second form,called" hulsview" to check the variable" hulsbreedte". The value selected in the combobox on on form1" hulsbreedte = HulsBreedte1.SelectedValue" returns always 0 in the textbox on de second form.

Here is the code form1:
Imports System.Drawing.Drawing2D
Public Class Form1
Inherits System.Windows.Forms.Form
Public hlb As Point 'not used
[Code] .....
I am using vb express 2010.

View 1 Replies

Forms :: Reference Form Using Variable

Aug 18, 2010

I have an application consisting of 2 forms (Form1 and Form2).There is a text box on each form and they are both named Text1.From a sub routine in a module, I want to alter a text box on one of the forms. The sub determines which form to write to and attempts to refer to the form using a variable.But in the example below, gForm never gets declared when it's nested within the If statement.[code]The actual application is not so simple and I need to use this or a similar approach throughout the application in order to reduce code redundancy.To recap, I want to alter a control on a form by replacing the form name with a variable name. [code]

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







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