Passing String From A Collection (2 Forms)?

Apr 8, 2012

I'm sure you've all seen this a lot before (in a variety of forms) but I think (hope) it's a bit different. <Not actual names of variables>I have two forms (form1 and form2). Form1 has 2 class-level variables, a string (m_String) and a collection(colCollection).Inside form1, the collection is loaded using a key. With an if-statement, the collection is matched to input (from a combobox) through the matching key.The chosen string from the collection is then passed to the m_String (confirmed with MessageBox.Show(m_String)

View 5 Replies


ADVERTISEMENT

VS 2010 Passing String Between Forms On Different Way?

Aug 14, 2010

I have two forms in my application. Form1 is shown on starting and when i hit button, both forms are shown but Form2 is in focus. Now thing what i need is to input some strings in Form2, then i need to send that string over send function from Form1. So when i click to Button in Form2 I need to transfer my string to Form1 and then use send function... I think this is easy but i didnt get any result with using Object (public property)...

View 15 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

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 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

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

Is There A Forms Collection

Mar 29, 2010

is there a forms collection inn vb.net?Essentially, I want to iterate though the forms and take action depending on particular settings.

View 2 Replies

Passing List / Collection From Class To Class

Apr 28, 2009

I seem to have problem with passing a collection/sorted list/ list of strings from one class to another.I am using property procedure to pass it, however nothing is sent to another class. There isn't any error messages either.[code]

View 3 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

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

Passing Info Between Two Forms

May 20, 2011

I have two forms named are form1 and form2 (form1.h / form2.h)There are a textbox and a button on form1 and form2.When I clicked the button on form1, it must fill the textbox on form2 and when I clicked the button on form2, it must fill the textbox on form1 how can I do it,when I define #include "Form2.h" in form1.h AND #include "Form1.h" in form2.h, it gets me an error "error C2065: undeclared identifier.

View 3 Replies

Passing Objects Between Forms?

Aug 11, 2010

I'm translating a document management application from vb6. I want to program with good habits and technique, so I'm asking for your opinion really rather than just a solution.I have a decent understanding of OOP, but I'm not very experienced in VB at all. What I'm doing now is trying to figure out the best way to pass objects between forms.For example, in my initialization form, I have an object that stores a group of database connections. I need to pass this object around because reconnecting takes a significant amount of time. There are other objects such as user info and permissions.

Public Class Form 1
Dim DB = New DBobject
Public Sub Form1_Load

[code]......

View 5 Replies

Passing Parameters To Forms

Jul 2, 2010

I designed a form simply holding a combo box, button & Datagrid, working well when executed from another erp application.Now i would like to get parameters from the application and pass on to the form. The parameter has to replace the value of Combobox value.

View 3 Replies

Passing Values Between Forms

May 27, 2009

I think I'm getting hung up on syntax here. I've got 2 forms and am trying to pass a textbox value from the 1st form to the 2nd. The textbox value is an unique ID #, so it's an integer value in the database. The ID displays in the textbox just fine on the 1st form. When I try to access the value of this ID textbox in code in the 2nd form, I see that the value is empty, or equal to "". But I see a valid ID # on the 1st form. Here's the code that shows me that the textbox equals "".

[Code]...

View 2 Replies

Passing Values Between Forms In VB?

Jun 4, 2012

solid rundown of how this process works using custom events &EventArgs, Im really having trouble wrapping my head around it

View 14 Replies

Passing Var Multiple Forms

Jan 28, 2010

I have a "Open File" menu on form1 that reads the user input data from the selected file, stores them into variables, passes on the var. to my form2 and loads up my form2 with the user input data. My code works But when I close my form2 and button click form1 to open form2, I still see the same input data I want all my text boxes to be blank.

View 8 Replies

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

Passing Variables Between Forms?

May 17, 2012

I have a Form1, the user types a "Client ID" in a textbox if it's not a valid one, it opens a Form2 in which the user selects the correct "Client ID", once selected he presses an OK button. And there comes the porblem.. it opens a new Form1 with the Client ID that he selected from Form2, but I still have the first Form1 opened.
I have two Form1 opened...

I which to keep the original Form1, but with the value sent from Form2..

I'm using this code:

Code in Form1
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code].....

View 2 Replies

VB 10 Passing Variables Between Forms?

Apr 12, 2011

I am working on a program, and I would like to have the program pass a name from on form to another.

This is my code :
form 1 :
Public Class Form1

[code].....

View 8 Replies

Forms :: Execute And Action When Passing A Certain Value

Apr 22, 2009

I'm making a simple game as my first personal Visual Basic program, and I've run into a small problem. I'm trying to make it so when you reach or pass certain amounts of experience, you receive 5 stat points, but the best I've been able to do so far is have the program add the points when you are in a small window of 2 values. This is what I have now:

If Val(lblTtlExp.Text) >= 100 And Val(lblTtlExp.Text) < 110 Then
lblStats.Text = Val(lblStats.Text) + 5
ElseIf Val(lblTtlExp.Text) >= 200 And Val(lblTtlExp.Text) < 210 Then

[Code].....

View 1 Replies

Forms :: Passing Variables Between Subs?

Sep 2, 2009

I'm having an issue where I need to pass the value in a variable from one sub to anotherHere is the scenario. I have two forms; Main_Form and frmClient. I take a value from frmClient and pass it into a sub called Form_Activate located in Main_Form. I then need to take the value from Form_Activate and use it in a sub called when the user selects a menu item in the toolstrip.Starting point is frmClient and the code there is this:

Private Sub Button1_Click(ByVal sender as System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Client As Integer

[code].....

View 9 Replies

Forms :: Passing Variables To Timers?

Sep 28, 2011

I have a form that holds min two timers, One is a 72 hour timer and one is a 12 hour timer.

What I am trying to do is have both run at the same time, when the 12 hour timer expires it'll bring up a form informing the user that in 60 hours the machine will reboot (or they can just hit reboot). When the 72 hour timer expires it reboots the machine.

BUT I know my managment is going to want to be flexable. e.g instead of 72 hours make is 54, and instead of 12 make it 6.

I wish to avoid using global variables

This is the code for the 12 hour one, How do I call it and set i12sec and i12min?

************************************************
Private Sub t12hTimer_Tick(sender As System.Object, e As System.EventArgs, i12sec As Integer, i12min As Integer) Handles t12hTimer.Tick
t12hTimer.Interval = 1000 '1000 Miliseconds = 1 second

[Code]....

View 1 Replies

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

Passing Several Textbox.text Between Forms?

Feb 18, 2012

I use the code

Dim Selvk As New Selvkost2
Selvk.PassedText = TextBox29.Text
Selvk.Show()
in mainform and the code

[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 13 Replies







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