VS 2010 Assign Same Value To Multiple Variables?
Nov 19, 2010
What is the cleanest way to assign a value to multiple variables? For example, how can I assign FALSE to each of Label1.Visible, Label2.Visible, Label3.Visible, Label4.Visible, and Label5.Visible.Is there anything like
code
Label1, Label2, _
Label3, Label4, _
[code]....
View 1 Replies
ADVERTISEMENT
Mar 30, 2012
This is my first attempt at writing a program that accesses a database from scratch, rather than simply modifying my company's existing programs. It's also my first time using VB.Net 2010, as our other programs are written in VB6 and VB.NET 2003. We're using SQL Server 2000 but should be upgrading to 2008 soon, if that's relevant.I can successfully connect to the database and pull data via query and assign, for instance, the results to a combobox, such as here:
[Code]...
How do I execute a query so as to assign each field of the returned row to individual variables?
View 2 Replies
Aug 1, 2010
i have a combobox and wish to assign multiple values if possible, eg is i select WESTERN EUROPE i would like the values to be: western europe OR western-europe AND Generic as the combobox is used to search for these strings within a listview (which is working fine for the combobox1.text but the listview sometimes has "western Europe" as "western-europe" and does not find it.
[Code]....
View 3 Replies
Jul 11, 2009
i remember that in Qbasic i could assign values to variables from a text file. (not in the code inside.). How to make the same in VB.NET?
View 5 Replies
Jun 28, 2009
I have this string, it's "x/y". How can I use the split function to rid the / and assign the x to myVariable and assign the y to myVariable2
View 1 Replies
Jan 28, 2009
I have a class file, myClass.vb. Here is an example of the file:
Private _active As Integer
Private _categoryID As Integer
Property active() As Integer
[code]....
when I want to assign a value to the variables in the class file, should I assign them like what I have in line 24, and 25 or line 28 amd 29? how I assign the variables in terms of performance?
View 2 Replies
Jun 20, 2009
I need to assign variables dynamically in a loop. In php you would use curly brackets but this doesn't work in vb.
Dim i As Integer
For i = 1 To 12
lblMonth{i}.text = 'whatever
Next
Anyone know how I can escape the the i variable so it becomes part of the string that precededs it?
View 7 Replies
Feb 23, 2010
How do I read a line in a database and split and assign them into variables?As of now, i can only load the entire database into a variable
sql = "Select * from MenuDatabase" How do i read the database line by line and spit the lines according to column?
View 1 Replies
Sep 27, 2010
I have code, shown below, that works all except for 1 thing: The variables being passed byRef get passed, but once modified in the else section of the "if me.invokerequired" code of RecordData, the variables are never updated in the calling function. To reiterate, the calling function does not receive the updated data that is in the variables custid and amt.When debugging, I see the data change in the else section of "if me.invokerequired", but once it returns from the callback the data is missing.[code]
View 15 Replies
Apr 18, 2010
I have a datagrid with customer data such as ID, name, email, phone etc.When I select a row (with a button or selectionchanged) I want to store that row's columns in variables like
dim email as string
dim name as string
email = dgCustomers.theselectedrow.theselectedcell
[code].....
View 1 Replies
Feb 14, 2012
I want to give a form two designs, one design on application startup and another when a button is pressed. Can I do this with another designer?
View 3 Replies
Dec 7, 2011
I have multiple pictureboxes, is there a way to assign the same event and code once for all the pictureboxes ?
View 5 Replies
Nov 22, 2006
I want to Assign the Value to Multiple Variable of same type in .net and that to in one line of Code.
View 6 Replies
Sep 20, 2011
I have a table, the color of the whole row depends on one of the two columns. Table: | ID | Name | Date | Ext Date |
Where Date color depend on the value, <15 is green, <30 is yellow and >30 is red. While Ext Date depends on value, >-14 is red, >-30 is yellow, <-29 is green and without Ext Date value will follow Date value.
I tried to put Switch in IIf but returns no color at all.
=IIf(Fields!countexten.Value="-",Switch(Fields!countdate.Value < 15, "Green", Fields!countdate.Value <30, "Yellow", Fields!countdate.Value > 29, "Red"),Switch(Fields!countexten.Value>-14, "Red", Fields!countexten.Value>-30, "Yellow", Fields!countexten.Value<-29, "Green"))
View 7 Replies
Aug 12, 2009
Is there a way to give a value to multiple variables (integers in this case), instead of all at once?
For instance, I have Dim aceVal, twoVal, threeVal, fourVal, fiveVal, sixVal, sevenVal, eightVal, nineVal, tenVal As Integer and, pending listbox selection, I'd like to assign threeVal fourVal and sixVal all values of -1.
View 3 Replies
Oct 24, 2011
i would like to say i am a novice programmer, in year 12. I am designing a small game for my HSC and one of my forms is getting very cluttered with controls and code. To resolve this cluttering, i have had the idea to create new forms for some aspects of the game (such as different game modes and so on). However, in order for that to happen i have to drag some variables of the new form to the old form, (these variables would be just booleans or integers to say whether you lost a game or won a game or something that would carry on to the main form.)
[Code]...
View 1 Replies
Mar 3, 2012
I'm trying to set multiple variables using a textbox.The way I'm trying to do it is have each variable seperated by a space so like this:#If textbox1.text.contains("test") then set variables from textbox1.text for each " " in textbox1.text define new variable(value, string1, string2, int1, int2, int3, int4, int5)#End If I just don't know how I would code something that can set these variables from a single line of text in a textbox seperated by nothing other than just spaces.
View 1 Replies
May 4, 2011
I have 12 Varibales in VB.Net.
If a = 1 _ Or b = 2 _ Or c = 3 _ Or d = 4 _ Or e = 5 _ Or f = 6 _ Or...... Then
Like That....
For that my string will be so long for 12 varibles...
SO is there is any other way to compare 12 variables
View 2 Replies
Mar 29, 2011
I would like to loop over two string arrays but does not work.[code]...
View 4 Replies
Jun 6, 2009
I have a sub which requires multiple counter variables. Is there a more efficient way of doing this. My example is simple. Image if I had 20 separate counters I was trying to manage. I would have to create 20 separate variables and then increment each in the desired place in the code.
Dim Counter1 as Double
Dim Counter2 as Double
Dim Counter3 as Double
[Code].....
View 7 Replies
Sep 25, 2010
I am trying to have it so that when a user hits a button to enter a shop, it will open a popup window which will have the shop's goods. The only problem is I can't figure out how to keep the variables working between the two windows.
I need to get the variable 'gold' to transfer to and from form2(the shop window) and whatever is bought at the store to transfer back to the main window.
Right now, when I go to form2 all the values are 0, and all the variables I used on form1 are undeclared on form2.
How do I access variables from form1 to show up in form2? Is there an easier way to accomplish this than using a separate form?
View 3 Replies
Jun 25, 2011
Is there any way to use a Select statement to Test multiple variables?
ie:
Dim x as integer = 1
Dim x as integer = 2
Dim z as integer = 3
Select Case x, y, z
View 4 Replies
Jun 8, 2011
I am wanting to get information from a text file into different arrays.
My current text file has a new line for each driver but I would like it to look something like this
[code]...
View 2 Replies
Jun 12, 2011
<pre-question blab>// skip if you want Might as well consider me new, as I haven't programmed in years, and that was only tinkering in Java. Trying to get back on track a bit, so starting with VB to get the feel going to continue learning. I don't mind putting in the effort to learn and look up, I just am not 100% sure what I should be looking into at the moment... Old programming I did was nothing advanced, only little things like calculators, notepad-esque writers, and that sort.</pre-question blab>
I'm BASICally wanting to know what I should look into for saving multiple variables of a custom class object to be loaded later. I've seen some things about text, and I can do that fine, but don't think it would be the proper/best way of handling things
at all. I also saw some talk of XML, SQL tables, etc. I just need a point in the right direction.
For a bit more info on my actual project, I was tinkering with a 'simple' program to allow users to create rooms/objects/etc., which will then be converted into Inform 7 language (an interactive-fiction language).The variables needing stored are objects with a number of string variables and integer variables. I need to be able to save those, then load them out later into an array of said objects.
For anyone needing a more VISUAL image of what I mean, here are a few screenshots to show you what I mean. Also, if anyone has ever used Adrift, it is (at the moment) very similar to it, but for the Inform language.
Screenshot 1
Screenshot 2
View 3 Replies
Nov 15, 2009
I have 10 forms and say 5 text box's on each one so a total of 50 of these text box's. But the program is only using one of these forms only (user selects the 1 Form out of the 10) so I was wondering can these forms Share the input text box's? I am thinking NO, if so then the only thing I can do is just use 5 shared variables that all the forms can utilize.
View 2 Replies
Jan 9, 2012
how to assign Hot Key? like F2, F3 and F5 from form?i am created two forms. if press F5 key. then goto to the Second form?
View 3 Replies
Aug 26, 2011
I need to pass two variables/strings to a background worker at the same time. he background worker needs to return the first variable, and the time consuming boolean result of the second variable.From what I have read, I can only pass an object that contains multiple variables.This is where I get confused
View 1 Replies
Mar 29, 2011
I'm looking to be able to save and load the content from multiple structured arrays and variables into/from an encrypted file, is there any reliable source of information or tutorial that I'd be able to use for this? I've never written a program in visual basic that writes to/reads from a file.
I'm using microsoft visual studio 2008.
View 4 Replies
Feb 17, 2011
I'm using a Listview in VirtualMode, so I can 'add' a lot of files almost instantly. A Listview in VirtualMode does not allow sorting, so I need to sort the data myself. The data is stored as a List of Structure (it's faster to load than a List of ListViewItem). The code below works fine, but I need to sort based on multiple variables in the Structure. Code:
View 2 Replies
Mar 9, 2012
Anyone know right off hand a cleaver way to chop up a Text value from a table... Scenerio is this I have one table with a name (Smith, Timmy Alan) in a table text(30) format. I can pull the value to a string in VB but I want to only take the last name for one string and the first for an other string.
View 4 Replies