which control?

L

Lasse Edsvik

Hello

Im wondering if there is some control in VS similar to listbox, im getting
data from a database and i would like to present it like this:

Col1 Col2 Col3
1 A B
2 C D
3 E F


were each "row" is "selectable" and the Col1-3 end up as headlines

/Lasse
 
N

Nicholas Paldino [.NET/C# MVP]

Lasse,

Have you tried the DataGrid? It will give you exactly what you want.

Hope this helps.
 
L

Lasse Edsvik

hmm, almost....

is it possible to make it non-editable?

goal is that I should just click on one row and it opens a form with the
data for that product that is editable.

not sure if that's possible, not sure how to get the current ProductID (in
my case) for the row i clicked on


Nicholas Paldino said:
Lasse,

Have you tried the DataGrid? It will give you exactly what you want.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Lasse Edsvik said:
Hello

Im wondering if there is some control in VS similar to listbox, im getting
data from a database and i would like to present it like this:

Col1 Col2 Col3
1 A B
2 C D
3 E F


were each "row" is "selectable" and the Col1-3 end up as headlines

/Lasse
 
N

Nicholas Paldino [.NET/C# MVP]

Lasse,

You can do this with any grid control, but you will have to write some
code.

To make it non-editable, you can set the ReadOnly property to true.

In order to click on one row and have it open a form, you would handle
the double click event handler. Once you have that, you can get the
currently selected row, and then use the indexer to get the value of the
column that you want to pass to your form constructor (or to your object, or
whatever routine you use). Of course, then you call your routine that
performs some action based on the value.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Lasse Edsvik said:
hmm, almost....

is it possible to make it non-editable?

goal is that I should just click on one row and it opens a form with the
data for that product that is editable.

not sure if that's possible, not sure how to get the current ProductID (in
my case) for the row i clicked on


message news:[email protected]...
Lasse,

Have you tried the DataGrid? It will give you exactly what you want.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Lasse Edsvik said:
Hello

Im wondering if there is some control in VS similar to listbox, im getting
data from a database and i would like to present it like this:

Col1 Col2 Col3
1 A B
2 C D
3 E F


were each "row" is "selectable" and the Col1-3 end up as headlines

/Lasse
 
L

Lasse Edsvik

roger that! :)

one more question.....

is it possible to add a symbol after each row? a
click-here-to-edit-this-one-symbol :)

/Lasse

Nicholas Paldino said:
Lasse,

You can do this with any grid control, but you will have to write some
code.

To make it non-editable, you can set the ReadOnly property to true.

In order to click on one row and have it open a form, you would handle
the double click event handler. Once you have that, you can get the
currently selected row, and then use the indexer to get the value of the
column that you want to pass to your form constructor (or to your object, or
whatever routine you use). Of course, then you call your routine that
performs some action based on the value.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Lasse Edsvik said:
hmm, almost....

is it possible to make it non-editable?

goal is that I should just click on one row and it opens a form with the
data for that product that is editable.

not sure if that's possible, not sure how to get the current ProductID (in
my case) for the row i clicked on


message news:[email protected]...
Lasse,

Have you tried the DataGrid? It will give you exactly what you want.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello

Im wondering if there is some control in VS similar to listbox, im getting
data from a database and i would like to present it like this:

Col1 Col2 Col3
1 A B
2 C D
3 E F


were each "row" is "selectable" and the Col1-3 end up as headlines

/Lasse
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top