By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

Create column in a Datagrid

P: n/a
Hi,
I have two different questions to ask:

QUESTION 1:
Can I create dinamically a column in a datagrid? How?
I have a datagrid that must have 5 columns, but in some very special cases I
have to add another column. How can I do this in code?
QUESTION 2:
When I Debug my Web application, the debug is very slow. Changes line (step
by step) is slow.
Can I fix in anyway this problem?
I already try to see if any process is running, but I can't find anything
special.
Suggestions are welcome.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
QUESTION 1:
Look at the help for DataGrid.Columns property and the example in the help
for DataGridColumnCollection.
A note from the help:
Although you can programmatically add columns to the Columns collection,
it is easier to list the columns statically and then use the Visible
property to show or hide the column.
Eliyahu

"ruca" <ru***@iol.pt> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have two different questions to ask:

QUESTION 1:
Can I create dinamically a column in a datagrid? How?
I have a datagrid that must have 5 columns, but in some very special cases I have to add another column. How can I do this in code?
QUESTION 2:
When I Debug my Web application, the debug is very slow. Changes line (step by step) is slow.
Can I fix in anyway this problem?
I already try to see if any process is running, but I can't find anything
special.
Suggestions are welcome.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 18 '05 #2

P: n/a
QUESTION 1:
I alredy get the solution. Here it is:
Dim col As New BoundColumn
col.HeaderText = [Header Label]
col.DataField = [FieldName]
col.Visible = True
col.ReadOnly = True
[datagrid name].Columns.Add(col)
QUESTION 2:
Waiting for your help

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"ruca" <ru***@iol.pt> escreveu na mensagem
news:uu**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have two different questions to ask:

QUESTION 1:
Can I create dinamically a column in a datagrid? How?
I have a datagrid that must have 5 columns, but in some very special cases I have to add another column. How can I do this in code?
QUESTION 2:
When I Debug my Web application, the debug is very slow. Changes line (step by step) is slow.
Can I fix in anyway this problem?
I already try to see if any process is running, but I can't find anything
special.
Suggestions are welcome.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 18 '05 #3

P: n/a
How can I access then to my dinamic column?

I try this, but doesn't work:

Dim str as String

str = Cstr(dg.SelectedItem.Cells(6).Text)

it says that it's out of range. I count the columns and I have 6 columns and
when I add dinamic column I'll have 7 columns, but I can't access the last
(it's dinamic)
How can I solve this?
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Eliyahu Goldin" <re*************@monarchmed.com> escreveu na mensagem
news:e6*************@TK2MSFTNGP11.phx.gbl...
QUESTION 1:
Look at the help for DataGrid.Columns property and the example in the help
for DataGridColumnCollection.
A note from the help:
Although you can programmatically add columns to the Columns collection,
it is easier to list the columns statically and then use the Visible
property to show or hide the column.
Eliyahu

"ruca" <ru***@iol.pt> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have two different questions to ask:

QUESTION 1:
Can I create dinamically a column in a datagrid? How?
I have a datagrid that must have 5 columns, but in some very special cases
I
have to add another column. How can I do this in code?
QUESTION 2:
When I Debug my Web application, the debug is very slow. Changes line

(step
by step) is slow.
Can I fix in anyway this problem?
I already try to see if any process is running, but I can't find

anything special.
Suggestions are welcome.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca


Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.