473,651 Members | 2,582 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 1172
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(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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?

"Christophe rJ" <cm****@gmail.c om> wrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.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
3723
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 some cases. The strange thing that I have noticed is that there were no examples of this productivity gain (i.e., projects, programs, etc.,...). Can someone give me some real life examples of productivity gains using Python as opposed other...
0
5387
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 Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not published officially by Microsoft as part of the DAAB but it was given as a helper code in a sample .Net...
12
2667
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 ) {cout<<"a.value="<<a.value<<endl; } private: int value;
6
4739
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 appreciated. Thanks in advance
55
3530
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 Gunderloy http://www.larkware.com/dg4/TheDailyGrind726.html Aside from the Sharepoint feature extension, amazing news.
0
1510
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 to in my Itemcommand event of the datalist. When I press a button on the datalist, that brings me into the Itemcommand event. I have access to the datagrid control, but not any column controls on the datagrid. For instance, my first column is...
8
2148
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 only intuitively thought that the latter was the one being used. Since it does not seem to make sense to let an instance "a1" of Class "A" to have access to the private data of instance "a2" of the same Class A, does it?
8
1861
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. This would mean that either some other variable is also written when writing a 32-bit variable (which means that all access to 32-bit variables is of the read-modify-write type, affecting some other variable also), or that all 32-bit variables are...
7
2289
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 FindControl the only way to do it?
0
8347
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8694
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8457
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8571
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4143
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
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
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.