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
ADVERTISEMENT
Jan 10, 2011
Say that i have the following code that parse about 20k records from the DB.
Code #1
vb.net While reader.Read()
list.Add(If(Integer.TryParse(reader(0).ToString, 0), Integer.Parse(reader(0).ToString), 0))
End While
And then another code which does the very same thing but it seems to be a little cleaner.
Code #2
vb.net While reader.Read()
Dim storeowner As Integer = 0
Integer.TryParse(reader(0).ToString, storeowner)
list.Add(storeowner)
End While
This is what i am confused about; does the compiler creates a new variable automatically when i use the if statement without strictly declared variable? What approach is better in sense of performance?
View 2 Replies
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
Jun 2, 2011
Say I have something like this
Dim Level1 as Integer = 83
Dim Goal as String
Goal = InputBox(" What level is your goal?")
[code].....
View 7 Replies
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
Aug 26, 2009
Is it possible to pass a variable set in one form to another?
View 12 Replies
May 18, 2012
If a string variable contains the name of an integer variable how do I then use the contents of the integer variable.i.e.I have a string variable called 'Rowname' which will contain the name of an integer variable.The integer variables will have been previously defined with values such as RowA = 0, RowB = 5, RowC = 10..I now want to add together the contents of the variable defined in 'RowName' with a the contents of an integer variable ColumnNumber.
View 7 Replies
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
Jan 17, 2012
i want to create a program that pressing a button will increment an integer variable and a textbox will show the result. Te code i wrote is below:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dim i as integer
i = i+1
textbox1.text = i
End Sub
now, the same code works for the vb6 form but on vb 2010 the textbox just show 1 and does not increment any further.
View 3 Replies
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
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
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
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
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
May 29, 2011
So I have an arraylist with some strings in it in one private sub. But I would like to use this same arraylist in a different private sub also. How could I accomplish this?
I tried changing the subs to public but still got the "is not declared" error. And I tried switching the arraylist's dim with public only to get another error.
View 7 Replies
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
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
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
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
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
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
Aug 27, 2011
Is it possible to use a Variable that reside on another Form?
View 5 Replies
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
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
Apr 16, 2012
I'm a newbie writing my first app. I need help with the following: I need to retrieve the logged in user which = GID, I then need to append it to a URL which will start our Help Desk chat client. I can retrieve the GID easy enough but can't figure out how to append it and pass it with the URL. I found a post which instructed to declare the url as a string also and concatenate it. The UserName would follow the ":" at the end of the Url.
[Code]...
We use javascript to do this from the HelpDesk site, but I need to adapt it to work from my app.
View 1 Replies
Nov 4, 2011
I'm using VB 2010 Express and have a label named "lblTitle" in my form.The next code doesn't work and I know it , but how can I do something like this?
Dim bla As String
bla = "lblTitle"
bla.Text = "Hello world"
[code].....
View 5 Replies
Aug 28, 2010
I need to get the handle of a variable. How do I do this?
DEVICE_PARAMETERS = New PresentParameters
ZeroMemory(>>Handle of DEVICE_PARAMETERS<<, Marshal.SizeOf(DEVICE_PARAMETERS))
-Ren�
View 4 Replies
Mar 10, 2012
I have the following line of code which keeps giving an error.[code]I know what is causing the error, it is the ItemCount which remains as ItemCount in the command line not the value of ItemCount but I can't work out how to get the integer value.
View 4 Replies
Jul 17, 2010
into a Sub or Function, there is an variable containing the Sub or Function name? Public Sub MyFunction..... subName = thisSubName obviously I can do subname= constant, but I want an semi-automatic way to log the running of several subs as CustomerDelete and so on. also in the validation events of input box's I want to do some kind of validation calling a function without constants, as result = validate(InputBoxName, InputBoxContent)
View 4 Replies
Oct 21, 2010
Public Class Form1 Dim CharList As ArrayList Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click CharList.Add(TextBox1.Text.ToUpper)End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
[Code]...
View 2 Replies