We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Form Variables

Thread ID:

Created:

Updated:

Platform:

Replies:

526 Jul 3,2002 09:41 AM UTC Jul 4,2002 04:53 AM UTC WinForms 2
loading
Tags: FAQ
Vipul Bhatt
Asked On July 3, 2002 09:41 AM UTC

Clay can U please tell me how do I refer to variables declared (Public if required) in one form from other form opened as vbmodal. Thanx in advance.

Anthony Mansfield
Replied On July 3, 2002 02:18 PM UTC

Vipul - A commin way to access and share information between forms is the use of a property procedure. 1. In formA add a private form level variable 2. In formA add a property procedure that exposes the private variable 3. In formB access the property procedure. VB.NET Example: (FormA) Private m_intMyValue as integer Public Property MyProperty() As Integer Get Return m_intMyValue End Get Set(ByVal Value As Boolean) If m_intMyValue <> Value Then m_intMyValue = Value End If End Set End Property (FormB) dim intValue as integer = FormA.MyProperty I hope that helps. Anthony Mansfield Development Xfactor

Vipul Bhatt
Replied On July 4, 2002 04:53 AM UTC

> Vipul - > > A commin way to access and share information between forms is the use of a property procedure. > > 1. In formA add a private form level variable > 2. In formA add a property procedure that exposes the private variable > 3. In formB access the property procedure. > > VB.NET Example: > > (FormA) > Private m_intMyValue as integer > > Public Property MyProperty() As Integer > Get > Return m_intMyValue > End Get > Set(ByVal Value As Boolean) > If m_intMyValue <> Value Then > m_intMyValue = Value > End If > End Set > End Property > > (FormB) > dim intValue as integer = FormA.MyProperty > > I hope that helps. > > Anthony Mansfield > Development Xfactor Hi Anthony. thanx. I just found a way to do this. FormA Friend Shared x as integer FormB msgbox(FormA.x) Anyway thanx a lot.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;