473,503 Members | 5,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to gain access to objet in different class ?

Can ant body help me to see how to get access to all controls of the
Form for Sub in a different class.

Thanks in advance.

this is how it looks:

////////////////////////////////////////
Form1
...........
..........

pirvate sub ButtonClick(.......)

dim A as X = new X
A.Write()
end sub

---------------------
//////////////////////////--------------------
Class X
inherits Form1

public sub ()
Code for Write()

.............

Form1.textbox1........
Form1.textbox2.......
Form1.textbox3.......
etc

//it works OK if I put this Form1 before every textbox but I have them
more than 50 !

if i dont - it doesnt work ( but I put inherits Form1 there !)

How can I work this out without manualy typing every time Form1 ?

.....
end sub
end class
//////////////////////////////////////

Jun 26 '06 #1
4 1160
okay .... you could try using the "with" keyword
With Form1
textbox1
end with

-ChristopherJ


au******@gmail.com wrote:
Can ant body help me to see how to get access to all controls of the
Form for Sub in a different class.

Thanks in advance.

this is how it looks:

////////////////////////////////////////
Form1
..........
.........

pirvate sub ButtonClick(.......)

dim A as X = new X
A.Write()
end sub

---------------------
//////////////////////////--------------------
Class X
inherits Form1

public sub ()
Code for Write()

............

Form1.textbox1........
Form1.textbox2.......
Form1.textbox3.......
etc

//it works OK if I put this Form1 before every textbox but I have them
more than 50 !

if i dont - it doesnt work ( but I put inherits Form1 there !)

How can I work this out without manualy typing every time Form1 ?

....
end sub
end class
//////////////////////////////////////


Jun 26 '06 #2
Thank you for reply. It doesn't work that way. Still need to add Form1
before the controls to make it work.

Public Class Class1
Public Sub Yo()
With Form1
Form1.TextBox1.AppendText(".........") < hier
End With

End Sub
End Class

-------------------------------------------------------------------------------------------

Public Class Form1

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

Dim x As Class1 = New Class1
x.Yo()
End Sub
End Class

I simlpify it just to describe the problem...

Jun 27 '06 #3
How about changing textbox1 to .textbox1 in the suggestion?

"ChristopherJ" <cm****@gmail.com> wrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
okay .... you could try using the "with" keyword
With Form1
textbox1
end with

-ChristopherJ


au******@gmail.com wrote:
Can ant body help me to see how to get access to all controls of the
Form for Sub in a different class.

Thanks in advance.

this is how it looks:

////////////////////////////////////////
Form1
..........
.........

pirvate sub ButtonClick(.......)

dim A as X = new X
A.Write()
end sub

---------------------
//////////////////////////--------------------
Class X
inherits Form1

public sub ()
Code for Write()

............

Form1.textbox1........
Form1.textbox2.......
Form1.textbox3.......
etc

//it works OK if I put this Form1 before every textbox but I have them
more than 50 !

if i dont - it doesnt work ( but I put inherits Form1 there !)

How can I work this out without manualy typing every time Form1 ?

....
end sub
end class
//////////////////////////////////////

Jun 27 '06 #4

Thank you thank you thank you

it worked with .

Jun 30 '06 #5

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

Similar topics

38
3699
by: kbass | last post by:
In different articles that I have read, persons have constantly eluded to the productivity gains of Python. One person stated that Python's productivity gain was 5 to 10 times over Java in some in...
0
5362
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
12
2646
by: Manolis | last post by:
Hi, I was wondering if there is any way to make two objects of the same class to be able to access each other's private data, like this: class A { public: void access( const A& a )...
6
4712
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
55
3485
by: AnandaSim | last post by:
I just had a google through this NG but have not seen mention of Erik Rucker's blog entry and the new Jet: http://blogs.msdn.com/access/archive/2005/10/05/477549.aspx mentioned by Mike...
0
1498
by: bill yeager | last post by:
I have a datalist displaying parent information and a datagrid presenting child information. The data is being rendered just fine. The datagrid has template columns on it that I cannot gain access...
8
2120
by: xz | last post by:
Why C++ (as well as Java) adopts class-based access control instead of instance-based access control? I had never paid attention to whether an access-control is class-based or instance-based but...
8
1847
by: Gerhard Fiedler | last post by:
Hello, I'm not sure whether this is a problem or not, or how to determine whether it is one. Say memory access (read and write) happens in 64-bit chunks, and I'm looking at 32-bit variables....
7
2280
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
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...
1
4992
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...
0
4666
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...
0
3160
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...
0
1495
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 ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.