473,385 Members | 2,013 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,385 software developers and data experts.

Syntax Question, C# 2005

I found the following code example in the Visual Studio help:

private void AddOutOfOfficeColumn()
{
DataGridViewCheckBoxColumn column = new
DataGridViewCheckBoxColumn();
{
column.HeaderText = ColumnName.OutOfOffice.ToString();
column.Name = ColumnName.OutOfOffice.ToString();
column.AutoSizeMode =
DataGridViewAutoSizeColumnMode.DisplayedCells;
column.FlatStyle = FlatStyle.Standard;
column.ThreeState = true;
column.CellTemplate = new DataGridViewCheckBoxCell();
column.CellTemplate.Style.BackColor = Color.Beige;
}

DataGridView1.Columns.Insert(0, column);
}

I am wondering what this means when the the curly braces are used
after the constructor of the DataGridViewCheckBoxColumn. Thanks in
advance.

Apr 4 '07 #1
3 1389
In this case... nothing; it is probably an artefact of an "if" block
that got removed.

In the more general case, braces *used in this way* can be used to
scope variables, but that is about it. There are of course many other
brace meanings with blocks, delegates, etc.

Marc
Apr 4 '07 #2
bs*******@oldrepublictitle.com wrote:
I found the following code example in the Visual Studio help:

private void AddOutOfOfficeColumn()
{
DataGridViewCheckBoxColumn column = new
DataGridViewCheckBoxColumn();
{
column.HeaderText = ColumnName.OutOfOffice.ToString();
column.Name = ColumnName.OutOfOffice.ToString();
column.AutoSizeMode =
DataGridViewAutoSizeColumnMode.DisplayedCells;
column.FlatStyle = FlatStyle.Standard;
column.ThreeState = true;
column.CellTemplate = new DataGridViewCheckBoxCell();
column.CellTemplate.Style.BackColor = Color.Beige;
}

DataGridView1.Columns.Insert(0, column);
}

I am wondering what this means when the the curly braces are used
after the constructor of the DataGridViewCheckBoxColumn. Thanks in
advance.
Doesn't mean much of anything in this code. If a variable had been declared
within the curly braces, then its life would be scoped to the end of the
curly braces (or that's the way it worked in C++ and I assume C# is the
same). I suspect you saw this at
http://msdn2.microsoft.com/en-us/lib...ckboxcell.aspx
or one of the other articles that have that code example. Looks to me like
some automated tool was used to generate the C# code for the example,
possibly from the VB.NET code in the same example, and the tool didn't
properly handle the With/End With code in the VB.NET example. But that's
just a guess.
--
Tom Porterfield

Apr 4 '07 #3
On Apr 4, 10:43 am, "Tom Porterfield" <tppor...@mvps.orgwrote:
bstauf...@oldrepublictitle.com wrote:
I found the following code example in the Visual Studio help:
private void AddOutOfOfficeColumn()
{
DataGridViewCheckBoxColumn column = new
DataGridViewCheckBoxColumn();
{
column.HeaderText = ColumnName.OutOfOffice.ToString();
column.Name = ColumnName.OutOfOffice.ToString();
column.AutoSizeMode =
DataGridViewAutoSizeColumnMode.DisplayedCells;
column.FlatStyle = FlatStyle.Standard;
column.ThreeState = true;
column.CellTemplate = new DataGridViewCheckBoxCell();
column.CellTemplate.Style.BackColor = Color.Beige;
}
DataGridView1.Columns.Insert(0, column);
}
I am wondering what this means when the the curly braces are used
after the constructor of the DataGridViewCheckBoxColumn. Thanks in
advance.

Doesn't mean much of anything in this code. If a variable had been declared
within the curly braces, then its life would be scoped to the end of the
curly braces (or that's the way it worked in C++ and I assume C# is the
same). I suspect you saw this athttp://msdn2.microsoft.com/en-us/library/system.windows.forms.datagri...
or one of the other articles that have that code example. Looks to me like
some automated tool was used to generate the C# code for the example,
possibly from the VB.NET code in the same example, and the tool didn't
properly handle the With/End With code in the VB.NET example. But that's
just a guess.
--
Tom Porterfield- Hide quoted text -

- Show quoted text -
Thank you for the responses. I suspected the same but couldn't be
sure.

Apr 4 '07 #4

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

Similar topics

19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
4
by: yaffa | last post by:
dear folks, i'm trying to append a semicolon to my addr string and am using the syntax below. for some reason the added on of the ; doesn't work. when i print it out later on it only shows the...
3
by: William | last post by:
i am using a dataset and a DataAdapter to update a table with the following schema: ResourceID ProjectID LastName FirstName Year Nov Dec Jan
2
by: bor_kev | last post by:
Hi, First of all, i want to use the new managed class syntax and STL.NET under Microsoft Visual (C++) Studio 2005 Beta. I read in a Microsoft...
4
by: T. Wintershoven | last post by:
Hi Can someone please tell me whats wrong with the last line of the query below. The first three lines work fine but when i add the fourth line i get an error message (see text at ERROR...
5
by: newtophp2000 | last post by:
Here is a simple question. I am having difficulty accessing books online at Microsoft so I thought I would ask here. What is the standard naming syntax for Sqlserver 2005? Assuming I had the...
1
by: obastard | last post by:
Hi Having a problem with a ms sql 2000 server. The script below was created i SQL manager 2005 lite and gives a syntax error near '(' ALTER TABLE . ADD CONSTRAINT PRIMARY KEY CLUSTERED ()...
4
by: Sharrukin Amiri | last post by:
Hello, I have issues which I do not know how to go about. For example, reading and writing into a textfile.txt. I have looking into some videos from learningvisualstudio.net. The instructor...
4
by: WT | last post by:
Hello, Using VS2005, when I open the global.asax file, the editor underlines in blue all the line with a tooltip saying 'Syntaxe error '. <%@ Application Language="C#"...
2
by: iitt2007 | last post by:
I need to convert Oracle SQL SPs and functions to SQL 2005. Table and columns names do match. Is there any tool which will 'convert' Oracle script yntax to to SQL 2005 syntax? I can't install it on...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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
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...

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.