HOW To Declare A Public Variable
Apr 23, 2012Later on i have a form where a cost for a class is calculated by timing the duration of a class by the costperhour textbox which is in a different form.
View 3 RepliesLater on i have a form where a cost for a class is calculated by timing the duration of a class by the costperhour textbox which is in a different form.
View 3 RepliesHow do declare a public variable .aspx web page that can be used in all the pages within my web application?
View 3 RepliesJust working on getting more fluent in Visual Basic over the summer so I'm still sharp for my next visual basic class. My teacher went over variables, but only in local scope.I have looked everywhere, but I can't find exactly what I need. I'm making an alarm clock of sorts, and I have this code to populate the minute array and the hour array.
Public Class Form1
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[code].....
Imports System
Imports System.Threading
Imports System.ComponentModel[code]....
how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.
Is their a reason why I cant declare a Public Const this way?
HTML
Public Const whatever as string = my.application.settings.xxx.tostring
I don't understand why not.
how to connect VB2010 to MS Access and how to declare the connection as public? I just switched from VB2010 from VB6.0 and found some major changes since VB6.0 in terms of interface and functionality. Must I use a global module for it just like in VB6.0 (.bas module)?
View 1 RepliesI'm trying to declare a array that I want to use in the module and in the forms. I like it to be usable all over but I cant get it to work.[code]...
View 3 RepliesWhen and why do you declare variables in the Public Class Form1 section?
View 1 RepliesHow can I declare public constants that are available solution wide across all projects?
View 8 RepliesI'd like to get a more refined programming style and I was wondering if any of you might give me a hand...(How to declare public variables, constants, functions...in a proper way),is there any useful link or pdf document I could have a look in order to improve my style?
View 5 RepliesWhat's the C# equivalent of
<% dim name %>
so you can use it for web forms in PayPal API integration?
why don't we declare a variable for instance variable with dim not private?
View 3 RepliesWhat is Different between global variable and public variable?
View 1 RepliesI want to know if it is possible to declare a variable thrice.
[code]...
I have a form with 2 controls, a textbox and a button. The user will type text into the textbox and then when they click the button the text that they entered will be added to a List Collection. You can see the code below. There is just 1 problem. Where would I put my declaration of my List Collection so that it holds the values and does not start at the first element everytime the button is clicked?[code]
View 5 RepliesI have been debugging my code for a while and looking at posts in other forums, but it seems to be that everyone has a different problem than mine and what works for them will not work for me.My dropdown list is supposed to filter a gridview by choosing all the Companies that are associated to a certain product. The solution I have found online is that most people did not have DataKeyNames set in their gridview. I do have this set, but not to CompanyID. It wouldn't make any sense. So I have no idea what I am supposed to do since this is the only answer I have found.
<asp:DropDownList ID="ddlCompany" runat="server" DataSourceID="dsCompanyFilter"
DataTextField="CompanyName" DataValueField="CompanyID" AppendDataBoundItems="true"
AutoPostBack="true">
[code]....
How do you declare a variable as a Date and initialize it with a date before year 1. I would like to caluate historical BC dates using a fuction that returns the ellaspt time.
I've used this line of code however I can't to work setting the date value to a negative.
Dim
myDate As Date = CDate("2/6/1400")
why we can't declare a variable on some class such as math
for example?
dim s as new math
?
but we should imports them..
I have searched online for a few hours to try to figure out how to do this, but nothing I found really makes sense, so could someone please tell me, in a simple way, how to do this?
Let's say I have a text box that the user fills out, named textbox1. And I have a combo box, named combobox1, which contains the choices A, B, C. And then I have a button named submit_button.
Each time that the user clicks submit_button, I would like to dynamically create a new variable. This variable should be named the same as textbox1.text, and should contain the value of combobox1.
For example, if the user types "blue" into textbox1, and chooses value "C" from combobox1, and then clicks submit_button... then the following variable should be dynamically created, like..Dim blue as String = "C"
And then, after that, if the user types "red" into textbox1, and chooses value "B" from combobox1, and then clicks submit_button... then another variable should be dynamically created, like...
Dim red as String = "B"
And each time the user submits new information into the textbox and combobox, a new variable should be created.Is it possible to have the program automatically create variables like this? If so, how?
My actual project is much more complicated than this, of course, so the above is just an example. But if I could figure out how to solve the problem in this example, I could figure out how to solve the entire project.
I can declare a variable in VB.NET that stays even after closing and re-opening the program?
View 2 RepliesWhat i am trying to do is this:
Dim Name as string
Name = "Bob"
Dim Name.tostring as Integer
Which will create as variable called Bob of type integer.
But obviously this code doesn't work. So what is the real way to do this if it can be done?
how to declare out global variable? i tried out but get error.. below is my orginal code
[Code]....
I'm trying to make a message box appear, I don't want to have to declare the message box as a variable, And I don't want it to be in it's own Sub!I just want it to print (variable) S, It's in a sub. Just not sure of the structure of that code. Just a really quick example
View 1 RepliesWhat's the main problem if I don't declare the type of a variable? Like, Dim var1 versus Dim var1 as Integer.
View 6 Replies I am working on an alarm system software, which is SMS-based. I am using a GSM modem to receive the SMS when a client's premise security devices are triggered. The types of SMS text received will be like for e.g. "fire alert"(when devices triggers), "fire clear"(when devices are 'reset').
My program can detect real and false alarm, it works this way, i will input a premise site-map on a picture box at the main GUI, i can then create buttons at run-time and drag them to the respective position on the map. The buttons created have their text set as the client's block number referred to the database. So basically, a button represent a client. When a device in the client's premise is triggered, a SMS will be sent and my GSM modem will receive it, process the SMS and the button representing the client will start 'flashing' showing that the client's premise is under danger. Then when the button is clicked, which acts as an acknowledgement, will display the client's information on labels and turning that specific button to red color. Finally, when the device is 'resetted' in the client's premise, it will send another SMS to my GSM modem, after processing, the button will be back to normal.
But my program has detect false alarms also, the first part is similar to mentioned above, client's premise security device triggers, SMS sent, SMS received by GSM modem, process SMS, button 'flashing'. Secondly, if the alarm is false, it will be automatically 'resetted' or the client may 'reset' it, then a SMS will be sent to my modem, turning the button to 'flashing' green in color. when 'acknowledged' will display the client's info and the button will become normal.
The problem here i am facing is during the processing of the SMS, because the real and false alarms both will receive the 'clear' SMS when during some stages, but the functions are different and of course the 'checking' for both functions will be different too. The problem occurs at the checking process whereby the 'btn' variable is not detected.
'Try
'AT commands to receive SMS
serialPort.Write("AT+CMGL=""REC UNREAD""" & vbCrLf) 'set command message format to text mode(1)
[Code]....
the error is pointing at : objAdapter.Fill(objDataSet, "placename")
the following is the code that is throwing an error.
Dim selectedname
As
String = "boston"
[Code]...
Must Declare Scalar Variable @ID?
View 11 RepliesThis seems so basic but I've been struggling to find a solution! I have a web page that take user data from aspx textboxes. Upon hitting a button, the click event submits the responses to a SQL table. Seems easy.I'm using VS10, dev express and VB code. I have established my datacontext class using LinqToSql...In a nutshell, the code is as follows...within the click eventNote that "database" was earlier defined as my datacontext sql connection, "Request" tablee
Dim vname As String = AspxTextbox1.Text
database.executecommand("INSERT INTO [Requests] (ContactName) Values (@vname)")
[code].....
im having this prob, when deleting a line from my gridview, this error shows out.Must declare the scalar variable "@productid".Well, i dont know whats wrong with the coding. As i have already declared the productid.
<table style="width:100%;">
<tr>
<td class="style24" colspan="2">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
[code]....
vb.net
Public Class UniQueGlobalConnector Public GlobalConnection As New OleDb.OleDbConnection Private Sub OpenConnection() Dim UniqueConnectionName As String = "GlobalConnection" & (Rnd(10)).ToString.Replace(".", "_") Dim InternalConnection As New OleDb.OleDbConnection GlobalConnection = InternalConnection
[Code]...