Passing Data Between Forms Vb 2008?

Oct 20, 2010

I need to pass a double from form1 to form2 and have form2 return this value back. My problem is while i can receive the proper value in form2 i can not seem to get the corrected value back in form1 (using byRef in form1). Here is the code snip

Dim AmountPaid As Double = 8
Dim newInvoiceRow As InvoiceDataSet.InvoiceRow
If (MakeAPayment.ShowDialog(AmountPaid) = Windows.Forms.DialogResult.OK) Then

View 4 Replies


ADVERTISEMENT

VS 2008 Passing Data Between Forms?

Jul 8, 2010

Form1 is a Datagridview which is non editable. I want a user to be able to double click and open Form2, which will allow editing BUTForm2 is a list view and also had a binding navigator so I guess I cannot use dialogue? I do not want to simply just edit in a dialogue and save.Is there an easy way to get the record from Form1 and pass it to the controls in Form2 so that the correct record is displayed?

View 5 Replies

[2008] Passing Data Between 2 Forms?

Jun 18, 2009

I am trying to pass data between forms on a double click operation. On Form1, I have a simple database with three fields (ProfileID(PK), Profile First, Profile Surname). The database has 10 records at present which displays all records in a datagrid view which is set to read only. I have the Selection Mode set to FullRowSelect to highlight the full row.Form2, is a form to Display one record at a time. This form allows editing and saving of changes.How would I go about coding in vb.net to firstly get the ProfileID from the relevant row and send this into Form2 to display that record for editing?

View 10 Replies

VS 2008 - Sending Data / Passing Value Between Forms

Dec 15, 2009

Imagine a project with couple of forms and a module. Now as per my knowledge if i want to send some data from one form to another then :

- If I declare variable friend/public in a module then it can be accessed in the entire project (thus also between forms).
- If I just have to send data from one form to another, then I can call the other form's sub/function and pass value.
- If the pass value by reference then I can get new value only if its changed in that function.

Now what the issue is, I need to pass a variable to a form and in that form when user types contents in a textbox or makes other selection and presses OK button then it should return some values back to the calling form. Now how can I achieve this (without declaring global variables which will be accessible everywhere) ?

View 14 Replies

Forms :: Share Data Between Forms (as Opposed To Passing Data)

Nov 26, 2011

Quite a few threads on passing data from one form to another, but I'm struggling to work out how to share data between the two - back and forth.

For example:

Class1 is a class with 10 string properties

Form1 has 10 labels ("Label1", "Label2" etc) and a [Configure] button.
Form2 has 10 textboxes and a [Apply] button.

I want to load with Form1, and create an instance of Class1. Click the Configure button and load Form2, passing Class1. On Form2 I want to manually fill in the 10 textboxes and hit Apply. The Apply should update the Class1 instance and close the form.

Form1's Label controls should then be updated with the data from the Class1 instance.

I'm fine creating the forms and classes, as well as passing the class into Form2 with a custom Sub New(EmptyClass as Class1) constructor. This gets the empty class into Form2, but how can I get the populated class back to Form1?

As Form1 already exists I don't want to create a new instance with another custom Sub New(PopulatedClass as Class1)

It's also key to be able to use the Form2 multiple times, basically ending up with a Data class being displayed as part of Form1 but updated using Form2? (For example if the Class has already been created and populated with data when it's passed back to Form2 for the second time I would pre-load the Textboxes with the values already in the class).

View 3 Replies

Passing Data Between Forms Without Any Public Methods Or Properties On The Forms

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

Passing Data Between Forms

May 10, 2010

I have 2 forms. Using Visual Basic.On Form 1 there is a populated combo box. This was done so by running a query through it and populating it with PUZ_ID values from a data set.On form two there is a tool strip and below is a search query.I need to be able to select the value i want in the combo box on form 1, and launch a button that opens form 2, which has loaded the data that i binded onto the form.Anyone have any ideas/code or need me to clear this up a bit more?So i need to run something through a query, or make something public or what?

View 2 Replies

Passing Data Between Forms?

May 10, 2010

I have 2 forms. Using Visual Studio.

On Form 1 there is a populated combo box. This was done so by running a query through it and populating it with PUZ_ID values from a data set.

On form two there is a tool strip and below is a search query.

I need to be able to select the value i want in the combo box on form 1, and launch a button that opens form 2, which has loaded the data that i binded onto the form.

So i need to run something through a query, or make something public or what?

View 2 Replies

Variables - Passing Data Between Forms?

Jan 24, 2011

I have a form that has a button, when clicked it pops up a Dialog Form. Within this dialog form the user needs to select some data and when the user is finished they click the OK button. Once they click the OK button it needs to return an integer back to the previous form.I created a Dialog Form and tried calling it via the code below:

Dim intResult as Integer = frmData.ShowDialog()
Debug.Writeline(intResult)

However, it seems I can only return DialogResults (Abort, Cancel, Ignore...)I was wondering how I can try this without having to create a public variable and storing the result there.

View 3 Replies

Forms :: Passing Data Between Forms?

Nov 12, 2009

I have a gridview on a form pulling user data. I have also created a basic login system where users login and their username/password is checked against a table in SQL Server 2005.The gridview is on Form 2 but i am having great difficulty in returning the records in the gridview for the user that is currently logged in.

View 3 Replies

Passing Values Between Forms And Presenting Sql Data In Datagrid View

Jun 10, 2011

I have two forms and I am running a sql query to provide a set of variables in my first form that I need to pass to my second form. Here is the code that I have:[code]to form 2 which then shows the data retrieved from a sql query in the load event to a datagrid view.

View 19 Replies

VS 2008 Passing Date Between Forms?

Mar 18, 2010

I have read many post and none of them worked for me. This is what im trying to do. I made a login box in form 3 and when the user types in his login or pass word both gets saved to different Variables and I want to send to form 2.

[Code]...

Also I was wondering If I made a variable in form 2 and I access it from form3 and what ever value is in form 3 gets sent to form 2?

View 22 Replies

VS 2008 : Passing Values Between Forms Inside A DLL?

Aug 5, 2009

To start things up, I have a DLL called clsEmployeeModule, containing forms frmEmpInfo and frmAddEmpName. frmEmpInfo contains a textbox that when clicked displays the frmAddEmpName. Now the latter contains three textboxes (firstname, middlename and lastname) and a Save button. Once the user clicks Save, the values from the three textboxes will be concatenated and displayed as a full name back in the frmEmpInfo form.Below is the code snippet calling the frmAddEmpName:

vb
Private Sub empname_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles empname.Click If genInfo_edit = True Then call_addempname.Text = "Edit Employee Name" End If call_addempname.Show() End Sub

And here's the code snippet from the frmAddEmpName:

vb
Imports clsEmployeeModule Public Class frmAddEmpName Dim callempinfo As New clsEmployeeModule.frmEmpInfo Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click mnFname = firstname.Text

[code]....

When I debugged the program, it showed that employee_fullname was successfully populated with the concatenated values -- however, that wasn't the case for the empname textbox.

View 5 Replies

VS 2008 Passing Info From Textboxes In Different Forms?

Jun 13, 2011

Im looking to pass information from a number of textboxes in one form to a number of textboxes in another form using Visual Basic 2008.

View 2 Replies

2008 DLL Passing Data Among Different Exe's?

Oct 15, 2010

I have written a class library that creates a dll to pass data back and forth within the same compiled instance exe. Is it possble to configure this Class Library in order to pass the data produced in the first instance of an .exe to other instances exe programs written in VB.NET?

My first thought was to add a Module. Older versions used Declare Files. Is there something in the compiler that I should set where the variables point to a specific memory address, or something..., that makes the variable available to other VB programs running in a seperate instance?

[Code]...

View 2 Replies

Passing Data Between Form In VB 2008?

Dec 7, 2009

i have two form in vb form1,form2form1 contains button1,textbox1form2 contains utton2,textbox2form1 button1 contains code to show form2 myfrm2 As New Form2myfrm2.ShowDialog()

View 1 Replies

VS 2008 : Passing Data From DGV To Another Form?

Jul 8, 2010

I have returned to a project I started a while ago. I have a small members database showing basic info (Title, Forename and Surname) in a data grid view with all data populated from a SQL database. I have the dataset populated with all this info as well as other data through the use of relationships/foreign keys (Addresses and Telephone Numbers, etc)I have tested the relationships using a simple form which shows the correct addresses, telephones, etc for each user as you navigate through it.

I now wish to show just the datagridview on form 1 which is read only with the row select set to full row (I have done all this so far). I have also set up a second form which displayes just the relationship data.I want to be able to load the second form (with the address and telephone number data, etc) when the row is double clicked by the user. ie - if row 15 is double clicked on, then the second form should load the address and telephone number data for record 15.

View 3 Replies

VS 2008 Passing Data Through A Function?

May 3, 2009

what i am doing is passing data through to a function, the function does a basic check if the file passed through exists then say so in the listview

function:

Function checkIfCredentialsExist(ByVal Check As String)
Try
If File.Exists("credentials/" & Check) Then

[code]....

View 3 Replies

VS 2008 - Passing A Object Data To A Class?

Oct 5, 2010

I've got a main form (Form1.vb) where I created some controls (with the Designer).I've created a class myTextBox, inheriting from TextBox, in myTextBox.vb.In the main form, I call procedures from myTextBox. The issue is, those procedures use values from the Form controls. So the class doesn't recognise them as initialised.What's the best solution for this?I think I could pass the object itself as a parameter but doing it on each call seems a bitredundant and it thickens the code.Is there any way to access the Form1 controls and objects directly from the myTextBox.vb class?

View 6 Replies

Sending/Passing Data To UserControl Textbox VB 2008?

Oct 2, 2009

I have a form that loads a UserControl which has a tabpage. Each tab has textboxes that I need to update when I create the tab page. I actually had this working but lost a major version of the code and can not remember how I did it. I want to send data to usercontrol this way from the form Do While

count <= intGrpSize With TabCtrlClient() .TabPages.Add(New TabPageEx) UC.SetSessionDate(tbSessionDate.Text) uc.SetCouncelor(CInt(cbProviderID.Text))

[code]....

View 2 Replies

VS 2008 - Passing Data From WPF Parent To Child Form

Jan 27, 2010

In my WPF Form1 I have TextBlock1 that fill from AddressTableAdapter. To edit address user must click EditButton to open Form2 to perform changes. My problem is passing data to Form2 from Form1. In Form2 I have 3 TextBoxes Street, City, Zip, and StateComboBox. I try to code in Loaded procedure of Form2 like this and got error message:

Private Sub Form2Detail_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
Me.AddressTableAdapter.Fill(Me.AbcDataSet.Address)
Me.StreetTextBox = IIf(IsDBNull(AbcDataSet.Address.StreetColumn), "", AbcDataSet.Address.StreetColumn))
Me.StateComboBox = IIf(IsDBNull(AbcDataSet.Address.StateColumn), 0, AbcDataSet.Address.StateColumn))
End Sub

View 1 Replies

VS 2008 Passing A Form - Get The Error.'cmbDataTable' Is Not A Menber Of 'System.Windows.Forms.Form'?

Nov 26, 2010

I'm upgrading a project from VB6 to VB2008.I have a routine that clears a combo box, named 'cmbDataTable' which could be on any form. I pass the form and the combo box is cleared.


[code]...

I assumed it would be the same in VB2008 but I get the error.'cmbDataTable' is not a menber of 'System.Windows.Forms.Form'I am working my way through the project, first updating the global procedures - this is one - I haven't written the calls so cmbDataTable doesn't yet exist.

View 7 Replies

Forms :: Passing Several Textbox.text Between Forms

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

Forms :: Wonky Variable Passing In Forms

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

Forms :: MDI Forms And Passing Information

Dec 17, 2010

Example Form1 with data bound controls and a Public Variable Form1Var.Form2 with data bound controls and a Public Variable Form2Var DataTables are related Form2 Data is related to Form1 Data in a one-to-many.What I am trying to accomplish.When editing Form1 data there is a button to open Form2 if new data needs to be added. on closing Form2 I would like Form1 to remain at the state it was in before opening Form2. If I Change Visibility of Form1 when Form2 is opened upon Retun to Form1 Data is reloaded, if I minimise Form1 when Form2 is opened upon return to Form1 Public variables are reset to defaults.I have many Forms with many controls and buttons to do Lookups or additional add to related tables.

View 2 Replies

Forms :: Passing Information Between Forms

Aug 21, 2011

I'm getting a little fustrated, ive been trying to figure out how to allow my main from access to a sub form. what I'm initially aiming for is control of text and font color via a dialog on the main form and the results to appear on the second form, if that makes sense. Most of my knowlege resides around using VB.net for creating games and not progams. ill post the code so you guys might be able to get a better understanding of what im looking for as a result.

[Code]...

View 2 Replies

Forms :: Passing Values Between Forms

Jul 23, 2009

My scenerio is a form with a button, when clicked opens a form dialog. The dialog allows the user to enter a text box. I want to read the value of the text box from the main form into a variable to be used with an SQL statement. The following code is used to create a new instance of the form dialog if one does not exist:-

[Code]...

View 2 Replies

Forms :: Passing Variables Between Forms

Nov 27, 2009

I seem to be running into an issue. This may seem like a noob question (which it really is, I only have experience in vb6 from years ago) but what Im trying to do is pass a variable from one form to another. Ive tried telling the first form to set the value of the variable on the second form like so frmsecond.variable = "value" but that does not work. Ive tried placing a public variable in a module to do it, but again, no luck. The only way seem to be able to get it to work is the second form setting the variable by reading the value from the first form like so [code]The problem I have with that code is what if for some reason the selected line gets changed as the form is loading or something to that nature. It doesnt seem very secure.

View 5 Replies

Adding And Passing Value Between Forms

Apr 10, 2009

I am trying to do a really simple function (atleast it was simple in 6.0)... what I want to do is have two forms. One with a textbox, and one with a button and a textbox (we'll call this one form2). When I add a value to form2 and click the button I want the text to appear in form1's textbox.

My code in form2 is...
' on event button1_click...
form1.textbox1.text = me.textbox1.text
("me" being form2)
Anyways, how to pass a value from one form to another.

View 3 Replies

Asp.net - Passing Values Between Web Forms?

May 1, 2011

Im trying to pass a value of a date control from form1 to form2.on form 1.aspx.vb:

Public ReadOnly Property Property1() As Date
Get
Return StartDate.SelectedDate[code].....

Tried to assign the property to a string, it did not work either.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved