Passing Variable Between 2 Forms?
Jun 15, 2010
i have 2 forms -> form 1 and form 2
in form 1 -> 1 button
in form 2 -> 1 textbox and 1 button
when I click button in form 1, it will show the form 2..how can i pass the variable (data from textbox in form 2) into a variable in form 1 after clicking the button in form 2 ?
View 8 Replies
ADVERTISEMENT
Apr 22, 2010
This is my first Windows app to create since VB6. I've been in the world of ASP and ASP.NET for many years. However, now I have been asked to create a simple app that needs to be windows based.
[Code]...
View 4 Replies
May 22, 2011
I'm trying to pass value from form1 to form2, while both form is open.
Using New (Dim frm as new form2) only works when the form2 is not loaded yet. what if both forms already open?
PS: I don't want to use module since there will be a lot variable to pass and i don't want to maintain such large collection of variable in module.
View 4 Replies
Dec 28, 2009
Passing data between forms without any public methods or properties on the forms. everything but the "Controller" class, which I would like you furnish. I just changed the title from "Intermediate" to "Beginner" This solution is an example of the Observer Pattern. The "Controller" class is the "observed" class, which in this case means it publishes events.
' File Definitions.vb
Public Delegate Sub MessageDelegate(ByVal sender As Object, ByVal e As MessageEventArgs)
Public Class MessageEventArgs : Inherits EventArgs
Public Message As String
[CODE]...
The program should initially display Form1, and Form2. Clicking of the button on either form will modify the Title Text of both forms. I think that you will find the final end result to be pretty neat, as it works with any number of open forms not just two. I think asking for the Controller class is easier than asking for the code in the forms. My solution for Controller class has 7 lines of content, 9 lines if you include Class, EndClass. A minimal solution could achieved with only 4 lines of content, but it would a textbook example of bad programming.
View 12 Replies
Dec 14, 2011
I am using a function that is provided by the maker of an IO device that I'm using and the call for this device turns on and off the 16 ports on the IO device by sending the value true or false to the board. The call is as follows:
[Code]...
View 12 Replies
Oct 13, 2009
here's the snippet of my code that im trying to solve since last week...
icePayment.aspx If (Left(Request.Form("return_url"), 7) <> "http://") Then
errorInput = errorInput & "Invalid return URL path! <BR>" errorExist = True
Response.Redirect("InvalidUrlError.aspx")
Else
[Code]...
View 2 Replies
Jul 28, 2010
I use the code
Dim Selvk As New Selvkost2
Selvk.PassedText = TextBox29.Text
Selvk.Show()
[code]....
in my second form and the text passes. but I need to pass values from 20 textboxes. do I have to copy the code in my second form 20 times an declare passedtext2 and so on or is there an easier way to do this?
View 3 Replies
Aug 18, 2011
I have a variable that gets a value in a js function. I need to get its value as a double into a vb.net variable. I have tried putting the variable into a label then grabbing it from the label in vb.net as shown in the code below:
[Code]...
View 3 Replies
Feb 18, 2010
Dim SecondName As String = SecondNameTxtBox.text()Is the above statement a correct one?Here I want to assign the value of the text box into tat "SecondName".If it's wrong, please tell me the correct way to write this statement.
View 1 Replies
Nov 15, 2011
how to pass value from database to a variable.
This is my query:
Dim it As String = "Mouse"
Dim itNo As String
SELECT * FROM tblITEquipmentName WHERE equipmentName LIKE '" & it & "%'"
I would like to get the ItEquipmentNo and pass it to variable itNo
View 7 Replies
May 22, 2012
this is the linkbutton
<asp:LinkButton runat="server" ID="linkId" OnClick="doSomething(10)">ID
</asp:LinkButton>
and this is my sub
[code].....
View 2 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 23, 2011
Not sure how to do this sub that passes a variable that is used in a Dim.
fill_in_field("main_form.WebBrowser1")
Sub fill_in_field(ByRef WebBrowser As String)
Dim ElementCollection1 As HtmlElementCollection = WebBrowser.Document.GetElementsByTagName("input")
End Sub
Dim ElementCollection1 As HtmlElementCollection = WebBrowser & "Document.GetElementsByTagName("input")"
This is what I would like.
Dim ElementCollection1 As HtmlElementCollection = main_form.WebBrowser1.Document.GetElementsByTagName("input")
View 2 Replies
May 18, 2012
is there a way i can do like this in vb.net
[Code]...
what i want is that idx keeps incrementing after each line, without incrementing it on a seperate line.
View 1 Replies
Jul 6, 2009
I want to know if it's possible to retrieve the variables name from when it was passed into a certain function. For example, if I call parseId(myId) to a function with the signature parseId(id), i can obviously retrieve the value of 'id'. However, is there any way I can retrieve 'myId' as a string (without passing it as another value)? Specifically in vb.net, but I'm interested in how it would work in any given language.
View 3 Replies
Nov 15, 2010
I have a public variable that I declared in form1 of an application. I am trying to call that variable in form2 and then pass that variable in a sql query. If I declare:
Public Class Form1
Public payPeriodStartDate, payPeriodEndDate As Date
How then to I declare that variable in form2 and how to I pass it to my sql query.
Here is the code I have for form1: [Code]
and when I debug this form, no data will appear. I'm sure that it's something wrong with how I'm either calling the variable in form2 or in the query. Can anyone offer any assistance on this?
View 9 Replies
Apr 26, 2011
I have 2 dropdownlists, one is State and the second is City. I am trying to create it so, when a user clicks the State, the second dropdownlist is populated with City names from a datatable.[code]
View 3 Replies
Oct 20, 2009
passing a variable to a sub procedure by reference. Not sure I understand how it works. Here is the code.
Private Sub bntcompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntcompute.Click
Dim x, y As Double
getnumbers(x, y)
displaysum(x, y)
[code]....
Is the newly modified variable actually being Passed back? and If so where in the statement is it passed back. is it being passed back to the call getnumbers or is it passed back to the statement displaysum?
View 6 Replies
Nov 29, 2011
I'm using MVC2 with jquery.I'm trying to open a partial view in a jquery Dialog container, passing an itemID of an object to be deleted.What I'm doing to accomplish this is passing in an action that renders a view to jquery, which I can get to work without variables.f I try to pass in the ID of the object to be deleted, the action doesn't even trigger.
Here's my jquery code:
$(function () {
var itemToDelete
[code].....
View 1 Replies
Feb 18, 2010
Doing a small project where I would like to be able to print the results of certain calculations. I want to open a new form where the data can be neatly presented and printed. I just can't seem to make the data get passed along to the new form when I open it..
[Code]...
View 2 Replies
Oct 5, 2010
Do you just need to format the date? Such as msgbox(New Date(2010, 1, 1).ToString("yyyy-MM"))
Or do you need a hashtable:
[Code]...
View 1 Replies
Jul 15, 2010
I have a useform set up to have a user input value, and I would like to pass that value to a module. I have made the variable public along with the subroutine that I am trying to use the variable in. I have a message box display the value of the variable in the subroutine and the value is 0, even though I have inputted a value in the userform.
[YearForm]
Option Explicit
Public Sub UserForm_Click()
Me.intYear.Integer = Year
Module1.OpenFile Year
[Code] .....
View 5 Replies
Sep 3, 2009
I have a form with a list box. I'm calling it as a dialog. I can get the result of which button was pressed (OK/Cancel) but how do I get the value chosen from the list?
Dim frmCreateCSVFile As New CreateCSVFile
frmCreateCSVFile.dtpFirstEndDate.Value = dtpFirstEndDate.Value
frmCreateCSVFile.dtpLastEndDate.Value = dtpLastEndDate.Value
[code]......
View 1 Replies
Jun 22, 2010
I use VB .NET 2002 (academic version) I have created an MS Access database to be populated with vaules extracted from dBase files. Some numerical values can be null - ie where no data was recorded in the dBase file. Relevant field properties in MS Access mdb table are set to "Not Required" as follows - dt0 is the name in code of the Access table "AllData":
With dt0.Columns
.Append("Date", DataTypeEnum.adDate)
colTest.Name = "Ch1Deg"
[CODE]...
Using an INSERT INTO command I can send a null value to the field:
SQLMdb = "INSERT INTO [AllData]" " ([Date],[Ch1Deg])" & _
" VALUES ('" & dDate1 & "',null)
My problem is how to pass a variable which sometimes takes the value System.DBNull.
If I use SQLMdb = "INSERT INTO [AllData]" " ([Date],[Ch1Deg])" & _
" VALUES ('" & dDate1 & "','" & dDeg & "')
Then when dDeg is numeric then there is no problem and the table is populated. When data is missing and dDeg takes the value System.DBNull then it's a no go! The error message is "Data type mismatch in criteria expression."
Is there a way round this with VB .NET 2002 or do I need to upgrade to a later version which has nullable data types, eg nullable integers and doubles etc?
View 3 Replies
Jul 9, 2009
Is there a way to call or pass a variable to another sub? I'm trying to reterive a variable (or even a field name) in somethign like this:
Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
args.Graphics.DrawString(RS("field1"), New Font("arial", 8), Brushes.Black, 5, 5)
[Code].....
View 6 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
May 24, 2012
dim pvalue as datetime pvalue = (Date.Now.AddHours(3), Date.Now.AddMinutes(2))
above code getting error of ')' expected
No Error MessageBox.show(Date.Now.AddHours(3), Date.Now.AddMinutes(2))
View 4 Replies
May 31, 2011
I am trying to work with classes and variables and don't seem to understand some behavior that is going on.
first off the class
Public Class csSession
Public ID As Integer
Public Name As String
End Class
Usage and behavior (example code)
Dim S1 as new csSession
Dim S2 as new csSession
S1.ID = 1
S1.Name = "1st Session"
S2 = S1
S2.ID = 99
When I assign S2 = S1 all the values of S1 passes to S2 but also there is a "link" or bond between the two variables now. If I change the values of S2 this automatically changes the values of S1!! Why does this happen and how can I prevent it? I just want to pass the variables values contained S1 to S2.
View 12 Replies
Mar 17, 2010
With the code below data is keyed into a form and inserted into a table called Investors.After it is inserted, I'm trying to redirect back to the same page, passing the InvestorID on the querystring. Simply showing all of the information I just added, kind of insuring that it was posted to the database.
Code:
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
[code].....
View 1 Replies
Feb 23, 2012
I have a form in Visual Basic that is adding a row of data to an Access Database.What will happen (or rather what I would like to happen) is that when the form is created, a row will be added to said database. Once that row is added, I want to have another form open (called NewWindowA) which will pull information on that database that is related to the ID of the row that was created from the first form.I know that in NewWindowA I need to have the form load the values on Load. But my question is: How do you pass a value to a new window that's invoked by some action?
View 2 Replies