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.
Since my VB6 days I've longed for this feature. Every time you build a version it increments by one. On VS2005/2008 I've seen a few 3rd party programs or tips and tricks to get something similiar. I mean who wants to see a version no. like 1.0.1234.5678789 I used to use autobuildversion but can't seem to get it working on 2010. Has anyone managed to get the auto increment to work in any shape or form. I can't find the AssemblyInfo.vb file to edit so my program is stuck on 1.0.0.1 unless I manually increment it? I mean is it so hard to implement a built in auto increment function, or am I missing something?
I am using the AJAXToolkit Accordion control and dynamically adding panes to it based on a query of the database. For example:
Jane logs in and pulls up the page with the accordion on it. In the database she has five rows in the todo_list table. So, I need to dynamically generate five panes that contain the info. from the table...but if Joe logs in he may have only three rows, and Josh may have fifteen - so I can never know how many an individual will have beforehand.
So, I need some way to dynamically name the variables (or is there another way to do this). For example, here is some pseudo-code of what I'm trying to accomplish:
Dim i as integer For each row in todo_list Dim ap + i as New AccordionPane Add some info from the row to the pane Next
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?
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim counter As Integer = 0 Dim t As DataTable = DirectCast(Session("MyDataTable"), DataTable) Dim row1 As DataRow = t.NewRow() If (isUnique(t) And counter < 30) Then row1("ID") = counter + 1
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.
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.
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"
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.
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)
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
i am using the following VB6 code and I get this error Variable 'osv' is used before it has been assigned a value in VB2010.I want to use this code/method for getting the version, I just want to fix this
Public Class Form1 Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _ (lpVersionInformation As OSVERSIONINFO) As Long Private Structure OSVERSIONINFO Dim OSVSize As Integer
Is it possible to assign a pixel value of a binary file to infinity? Lets say that my binary file is composed of 4 pixels only and the values are (1, 4, 8, &)... Would it be possible to assign the fourth pixel to infinity?
I have created a class with a public sub which has a variable with it using byval: Public Class clsMessenger Public Sub Messenger(ByVal Port As Integer) End Sub End Class
I now need to start that sub in a new thread and pass a varible to it but I am not entirly sure how to go about that. At the moment I have: Dim ClientConnection As New clsMessenger Dim ClientThread As New Threading.Thread(AddressOf ClientConnection.Messenger) ClientThread.Start()
I can't use a global variable because there is going to be multiple instances of this routine running on different threads and each time the variable to be passed will be different.
is it possible to dynamically dimension a variable?in my case, i have a chart that has a varying number of series on it depending on the data extracted and in order to use those series, i have to dimension them manually before adding points to them, IE:
Dim series1 as New Series() Dim series2 as New Series() etc etc
my series data is contained in a datatable, so i'll know the count required, but it will change at runtime, so obviously doing something like this won't work, but explains what i'm trying to do:
dim recordcount as integer = datatable.rows.count for i = 1 to recordcount dim "series"+recordcount.tostring as new series() next
I get error "Variable 'retVal' is used before it has been assigned a value. A null reference exception could result at runtime." Here is my
Private Function JoinDomain() As Object Dim BungeOU As String = "OU=Computers" & ",OU=" & SitesCmboBx.Text & "O=Na.Dir.Bunge.Com" Dim args(4) As String 'Dim args2(2) As String
Public strDBData As New List(Of SearchDatabases) Public Structure SearchDatabases Public strName as String
[code].....
If you need to know what i'm doing this it it:I'm parsing a webpage that lists information such as; Name, Site URL, How many members etc.And thats fine, but i want to put the names in a listbox, and then when the user clicks a name in the listbox it displays the other data about that name such as the site URL and how many members they have.This is easy to do but i have made my listbox sorted so the names display alphabetically, so then my strDBData index's don't line up correctly, to fix this i need to sort the
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.