I have written all that is required at this point and have published the program. I thought that global variables were saved when the program terminated but, as I found out, they aren't. If anyone has any way of making the variables keep their values between uses of the program I would be very grateful as if the program is being run for the first time some global variables need to be set straight away (I have done this code). The variable types are: one boolean and a few strings.
I am looking for an easy way to save the value of a variable when a program is closed. And then when it is reopened the variable has the same value as what it was previously when the program was closed. The variable has an integer value.
I am trying to have a textbox to enter a run time in. i.e. 10:32 (ten minutes and 32 seconds). I will then need to have an if..then statement like this:
txtRun.text = Run If Run <= 9:12 then RunScore = 60
I have the following Public Class Payroll Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
[Code]...
and I'm trying to save the datetimepicker value as a variable to pass to a sql database. I'm just not sure what the datetimepicker value is, is it Me.DateTimePicker1.Value or is it dt?
the problem - i have a list box, which i use to display info (obvs) but when i click on one of items in the list when debugging, i wondered if there was a way to store which one was selected in a variable?
dim selected as string selected = 'vb variable for a click?
Currently, I've encountered a problem where I do not how I can store the variable of my battery level in a text file. I tried .xml and .txt file and it returns me text which can't be read.The code related:
vb.net [code]Dim psBattery As PowerStatus = SystemInformation.PowerStatus Dim perFull As Single = psBattery.BatteryLifePercent
[code]....
The place where I do not know what to insert is the "Insert Battery Percentage Here" part so I guess that's the problem.For your info, if you were to use a MsgBox to display, the code which displays that would be <MsgBox("Total battery power remaining: " & perFull * 100 & "%")>
Currently I am saving data from my applications by saving a text file via a stream reader as a string. I have come to a problem. In my current application, I have an array of the following structure:
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.
I have a problem. I'm working on this advanced web browser with my friend, and we made a favorites feature. So, it works and all that, but, after I close the executable file, it doesn't save anything!
Ex:Starting Up, adding Google as new favorites, then closing the browser. Starting up again, 1 hour later, but there's no Google Here's what I put for saving the favorites (please do not steal the code Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
rewriting a class I use for saving Treeview data to a XML file for use of saving ListView data I can't really figure out the rewrite, I'm stucked, unfortunately Listviews seems to be a big problem for me in general.
Option Strict On
''' <summary> ''' The TreeViewDataAccess class allows the nodes within a TreeView to be ''' persisted to xml for later retrevial. ''' </summary>
Public Class Form1 Dim x, c, number(0 To 19) As Integer Dim s As Integer
[CODE]...
The variables in the brackets [example] do not actually have brackets in them in the original code. These are where the issues are. For both variables, it says, "The type for variable [variable] will not be inferred because it is bound to a field in an enclosing scope. Either change the name of [variable], or use the fully qualified name (for example, 'Me.[variable]' or 'MyBase.[variable]')." Now, I'm not entirely sure if this is a stupid question or not, as I'm used to VB '98 because that's what we use in my programming class at High School. let me know why this won't work.
-Note: The intention of this program is to continually loop the generation of numbers for this list until I tell it to stop. Button1 ends the program, Button2 generates the list one time only, Button3 is supposed to loop the generation of the list, and Button4 is supposed to end the loop, but not the program.
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?
I am looking for a good resource on variable naming conventions to illustrate variable type and where variables are declared. So I will have public variables, Private variables, private or local variables. I also may want to declare variables with the same name in different class code (i.e. in the code behind different forms). I am assuming good coding would dicatate a prefix for declaration location.
i have this error in the line of with xl.active......Object variable or With block variable not set.
Dim xl As Object xl = CreateObject("Excel.Application") With xl.ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:Documents and SettingsUserDesktop429MEDICA2.TXT", _ Destination:=xl.Range("$A$1"))
Now I have the need to get a current value from a bindingsource in a property of a user control.In a previous thread I had tracked down the "Object variable or With block variable not set" to the return in the Get block of a property. At the time I was only using the Set so I just commented out the offending code until I needed it.
[Code]...
The error does not occur during a system compile, only upon saving the container object of the user control. As I said the Set works correctly, only the Get causes the error.I would like to know what I am missing/misunderstanding and am open to other suggestions of handling retrieving the current value of a bindingsource in a user control.
I am using vb2008.net express,I test vs2005term it work, can any tell me what is the input variable and output variable of this terminal?how to catch the input and output variable to a textbox1 for sending and a textbox2 for receiving when I press send button? is that possible?
I have the following code that I am using to parse out a test file. I am getting variable conversion error in Sub Main() when I assign file = Read(). The return value of Read() is a TextFieldParser type. How do I assign the proper variable type to "file" so I can write the output to a text file?
Function Read() Using MyReader As New FileIO.TextFieldParser("C:UsersColinDesktopParse_Me.txt") Dim currentRow As String
I have the following code but I get blue squiggly line in cnn and when i point my mouse pointer on it i see this message "Variable 'cnn' hides a variable in an enclosing block"
Private Sub BtnLockUnlock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLockUnlock.Click Dim IsLocked As Boolean = FpSpread1.ActiveSheet.DefaultStyle.Locked
I have the following code passing a dataView variable to a function and I am getting the following warning:"Variable 'cl' is passed by reference before it has been assigned a value. A null reference exception could result at runtime."
Function Editclass() Dim cl As DataView Bindclass (SqlConnection2, cl)
I'm having trouble tracking down what is wrong and causing the above error. This only occurs when saving the design view in VS 2012. The code builds and runs fine.Full error text:Code generation for property 'CompanyValue' failed. Error was: 'Property accessor 'CompanyValue' on object 'ContactViewUC1' threw the following exception: 'Object variable or With block variable not set."
CompanyValue definition in ContactViewUC: Public Property CompanyValue Get
I have the following code but I get blue squiggly line in cnn and when i point my mouse pointer on it i see this message "Variable 'cnn' hides a variable in an enclosing block".[code]