473,378 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Using VB's "With" in C#

In VB, you could start manipulating a controls properites and methods
just by using the statement
With <control name>
..Text=gnkn
end with

Does anyone know if there is anything similar in C#

Nov 16 '05 #1
4 1286
> Does anyone know if there is anything similar in C#

not really... the closest thing you can do is :
//***
TextBox t = this.txtMyTextBox;
t.Text. = gnkn;
t.ForeColor = Color.Red;
//...
//***
--
Best Regards
Yanick
Nov 16 '05 #2
VB.NET's With / End With is syntax sugar -- the functionally exact
equivalent in C# is:

SomeType st = Some.Really.Long.Heirarchy.Of.Stuff;
t.OneProperty = someValue;
t.AnotherProperty = someOtherValue;

For further info on why this is so, check out these two links:

http://www.gotdotnet.com/team/csharp.../ask.aspx#with

http://blogs.msdn.com/ericgu/archive.../15/59191.aspx
"John S" <jo********@cinfin.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
In VB, you could start manipulating a controls properites and methods
just by using the statement
With <control name>
.Text=gnkn
end with

Does anyone know if there is anything similar in C#

Nov 16 '05 #3
Hi

Check this for a detailed explanation:

http://www.gotdotnet.com/team/csharp.../ask.aspx#with

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"John S" <jo********@cinfin.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
In VB, you could start manipulating a controls properites and methods
just by using the statement
With <control name>
.Text=gnkn
end with

Does anyone know if there is anything similar in C#

Nov 16 '05 #4
Thakns Yanick. That helped.

Nov 16 '05 #5

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

Similar topics

10
by: Berthold Hoellmann | last post by:
Hello, When I use ./configure --with-thread --with-fpectl --with-signal-module \ --with-pymalloc --enable-shared --with-cxx=g++ make test on 2.3.3 I get
14
by: john.burton.email | last post by:
I've done some extensive searching and can't seem to find an answer to this - Is it correct to using "using" with templates, for example: using std::vector; Or do I need to specify the type...
9
by: mahurshi | last post by:
i have a quick question i am putting a debug flag in my program (i really dont need this feature, but i figured it might be useful when i get into trouble) so i want to check if argv is the...
9
by: Paul Brownjohn | last post by:
Hello I am new both to this group and to C# programming having spent the last 15 years or so writing C and VB. You will forgive I hope if I am asking the totally obvious but it is a question...
9
by: Mr Flibble | last post by:
Is there an equivalent of VB's "with" statement in c# ?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.