473,522 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Property Set/Get

Hi,
I have 2 forms, from1 and form2 and a class called classEntity which have a
property get/set for variable called Var1.
have how can I set Var1 to be = 2 in form1 and then get this value in form2

thanks
--
Regards,
M.Rochdi
Nov 23 '05 #1
3 2296
declare var1 as public so that you can use it in form2>
"Mike" wrote:
Hi,
I have 2 forms, from1 and form2 and a class called classEntity which have a
property get/set for variable called Var1.
have how can I set Var1 to be = 2 in form1 and then get this value in form2

thanks
--
Regards,
M.Rochdi

Nov 23 '05 #2
yes, but if I want to access the value of Var1 in from2 I have to create an
instance of form1 using "New" keyword and by doing that the value of Var1
from form1 will be lost.
--
Regards,
M.Rochdi
"danmbuen" wrote:
declare var1 as public so that you can use it in form2>
"Mike" wrote:
Hi,
I have 2 forms, from1 and form2 and a class called classEntity which have a
property get/set for variable called Var1.
have how can I set Var1 to be = 2 in form1 and then get this value in form2

thanks
--
Regards,
M.Rochdi

Nov 23 '05 #3
You will need to pass an instance of form1 into form2 so that form2 can
access the properties of form1. No need to create a new instance of
form1.

Form2:

Private _form1 As Form1
Public Sub New(f As Form1)
_form1 = f
End Sub

Public Sub Foo()
MsgBox(_form1.Var1)
End Sub

Form1:

Public Sub Bar()
Dim f2 As New Form2(Me) '<---- Pass Form1 into form 2

f2.Foo()
End Sub

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2463
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of the properties is a follows (irrelevant code omitted):
2
1747
by: Edward Diener | last post by:
How does one specify in a component that a property is a pointer to another component ? How is this different from a property that is actually an embedded component ? Finally how is one notified in a component when another component is destroyed ? I have a managed component called P. Let us say that C is another managed component. If on P I...
0
5548
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the...
3
6721
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the following default properties: Height = 32px, Width = 144px. I declare the Width property in my control as... \\\
15
1880
by: Sam Kong | last post by:
Hello! I got recently intrigued with JavaScript's prototype-based object-orientation. However, I still don't understand the mechanism clearly. What's the difference between the following two? (1)
15
2024
by: Lauren Wilson | last post by:
Owning your ideas: An essential tool for freedom By Daniel Son Thinking about going into business? Have an idea that you think will change the world? What if you were told that there was no way you could prevent someone from stealing your idea and exploiting it to make a profit? What incentive would there be for you to be innovative,...
0
1972
by: Memfis | last post by:
While I was looking through the group's archives I came across a discussion on doing properties (as known from Delphi/C#/etc) in C++. It inspired me to do some experimenting. Here's what I came up with. First we have an interface defining how a property can be used (read and written - for simplicity, I ignored read-only and write-only...
0
25493
ADezii
by: ADezii | last post by:
The motivation for this Tip was a question asked by one of our Resident Experts, FishVal. The question was: How to Declare Default Method/Property in a Class Module? My response to the question was inadequate to say the least, but I was determined to come up with the correct answer, especially since my primary background is Visual Basic, and I...
1
1347
by: cday119 | last post by:
I have a Class with about 10 properties. All properties return right except for one. It is real annoying and I can't see why its not working. Maybe someone else can see something. It is the NumberLines property. I can set it to 4 but when it returns it is set to 1 Public Class Profile Private ProfileFileName As String Private...
10
9990
by: Derek Hart | last post by:
I can set focus to my property grid by using propgrid.Focus - but how can I set the default property that is always first? Or just set focus to the default property? Can this be done?
0
7633
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5165
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4810
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3308
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3298
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1690
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
535
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.