473,783 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

little help with datagrid

Hello everybody

I'm still on the learning curve here...and from what I read, I created
inherited datagrid class so I could have icons, combobox...etc in the
columns of my datagrid.

The grid will be used to populate information coming from a Webservice. (No
datasets - No datareaders).
So, I do not know see how to use the "datasource ".

Now I'm almost there...but I would need a little bit of help to
programatically populate the datagrid.

Here is , (I hope) a short code that I use. I create a grid with 3 columns.
the column 1 is a column with text + icon called DataGridIconTex tColumn
inherited from the class of the same name.
the column 2 is a column with icon called DataGridIconOnl yColumn inherited
from the class of the same name. Depending on some "flag" I will be using 1
icon or another.
The column 3 is a regular DataGridTextBox Column
'load some icons from embedded resources
Me.Icons = New ImageList
Dim iconName As String
iconName = "datagridicons. user.ico"
Dim strm As System.IO.Strea m
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
Dim icon As Icon
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser1.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser2.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)

Dim tableStyle As DataGridTableSt yle
tableStyle = New DataGridTableSt yle
tableStyle.Mapp ingName = "customers"

Dim numCols As Integer
numCols = 3

Dim iconColumn As DataGridIconTex tColumn
iconColumn = New DataGridIconTex tColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn.Head erText = "headercolu mn1"
iconColumn.Mapp ingName = "headercolu mn2"
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim iconColumn2 As DataGridIconOnl yColumn
iconColumn2 = New DataGridIconOnl yColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn2.Hea derText = ""
iconColumn2.Map pingName = "Icon"
iconColumn2.Wid th = Me.Icons.Images (0).Size.Width
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim aColumnTextColu mn As DataGridTextBox Column
aColumnTextColu mn = New DataGridTextBox Column
aColumnTextColu mn.HeaderText = "headercolu mn3"
aColumnTextColu mn.MappingName = "headercolu mn3"
tableStyle.Grid ColumnStyles.Ad d(aColumnTextCo lumn)
' make the dataGrid use our new tablestyle and bind it to our
table
dataGrid1.Table Styles.Clear()
dataGrid1.Table Styles.Add(tabl eStyle)
Now, using a loop (for instance for i = 0 to 5 ...etc), can somebody show me
how to populate the grid ?
Thank you very much in advance
Nov 20 '05 #1
14 1842
Hi,

Brett what format is the data coming from the webservice in? You
can bind a datagrid to an collection or arraylist.

Ken
--------------------
"Brett Sinclair" <lb*@nospam.com > wrote in message
news:e9******** *****@tk2msftng p13.phx.gbl...
Hello everybody

I'm still on the learning curve here...and from what I read, I created
inherited datagrid class so I could have icons, combobox...etc in the
columns of my datagrid.

The grid will be used to populate information coming from a Webservice.
(No
datasets - No datareaders).
So, I do not know see how to use the "datasource ".

Now I'm almost there...but I would need a little bit of help to
programatically populate the datagrid.

Here is , (I hope) a short code that I use. I create a grid with 3
columns.
the column 1 is a column with text + icon called DataGridIconTex tColumn
inherited from the class of the same name.
the column 2 is a column with icon called DataGridIconOnl yColumn inherited
from the class of the same name. Depending on some "flag" I will be using
1
icon or another.
The column 3 is a regular DataGridTextBox Column
'load some icons from embedded resources
Me.Icons = New ImageList
Dim iconName As String
iconName = "datagridicons. user.ico"
Dim strm As System.IO.Strea m
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
Dim icon As Icon
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser1.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser2.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)

Dim tableStyle As DataGridTableSt yle
tableStyle = New DataGridTableSt yle
tableStyle.Mapp ingName = "customers"

Dim numCols As Integer
numCols = 3

Dim iconColumn As DataGridIconTex tColumn
iconColumn = New DataGridIconTex tColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn.Head erText = "headercolu mn1"
iconColumn.Mapp ingName = "headercolu mn2"
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim iconColumn2 As DataGridIconOnl yColumn
iconColumn2 = New DataGridIconOnl yColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn2.Hea derText = ""
iconColumn2.Map pingName = "Icon"
iconColumn2.Wid th = Me.Icons.Images (0).Size.Width
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim aColumnTextColu mn As DataGridTextBox Column
aColumnTextColu mn = New DataGridTextBox Column
aColumnTextColu mn.HeaderText = "headercolu mn3"
aColumnTextColu mn.MappingName = "headercolu mn3"
tableStyle.Grid ColumnStyles.Ad d(aColumnTextCo lumn)
' make the dataGrid use our new tablestyle and bind it to our
table
dataGrid1.Table Styles.Clear()
dataGrid1.Table Styles.Add(tabl eStyle)
Now, using a loop (for instance for i = 0 to 5 ...etc), can somebody show
me
how to populate the grid ?
Thank you very much in advance

Nov 20 '05 #2
Ken,
There will be several "complex" format received.
The most common case will be an array list, which will be composed itself of
columns strings, enum types, date or subarrays.

But for each line, I will display different icons based on the result
received.

Thanks for your help.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:Ob******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Brett what format is the data coming from the webservice in? You
can bind a datagrid to an collection or arraylist.

Ken
--------------------
"Brett Sinclair" <lb*@nospam.com > wrote in message
news:e9******** *****@tk2msftng p13.phx.gbl...
Hello everybody

I'm still on the learning curve here...and from what I read, I created
inherited datagrid class so I could have icons, combobox...etc in the
columns of my datagrid.

The grid will be used to populate information coming from a Webservice.
(No
datasets - No datareaders).
So, I do not know see how to use the "datasource ".

Now I'm almost there...but I would need a little bit of help to
programatically populate the datagrid.

Here is , (I hope) a short code that I use. I create a grid with 3
columns.
the column 1 is a column with text + icon called DataGridIconTex tColumn
inherited from the class of the same name.
the column 2 is a column with icon called DataGridIconOnl yColumn inherited from the class of the same name. Depending on some "flag" I will be using 1
icon or another.
The column 3 is a regular DataGridTextBox Column
'load some icons from embedded resources
Me.Icons = New ImageList
Dim iconName As String
iconName = "datagridicons. user.ico"
Dim strm As System.IO.Strea m
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName) Dim icon As Icon
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser1.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName) icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser2.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName) icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)

Dim tableStyle As DataGridTableSt yle
tableStyle = New DataGridTableSt yle
tableStyle.Mapp ingName = "customers"

Dim numCols As Integer
numCols = 3

Dim iconColumn As DataGridIconTex tColumn
iconColumn = New DataGridIconTex tColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn.Head erText = "headercolu mn1"
iconColumn.Mapp ingName = "headercolu mn2"
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim iconColumn2 As DataGridIconOnl yColumn
iconColumn2 = New DataGridIconOnl yColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn2.Hea derText = ""
iconColumn2.Map pingName = "Icon"
iconColumn2.Wid th = Me.Icons.Images (0).Size.Width
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim aColumnTextColu mn As DataGridTextBox Column
aColumnTextColu mn = New DataGridTextBox Column
aColumnTextColu mn.HeaderText = "headercolu mn3"
aColumnTextColu mn.MappingName = "headercolu mn3"
tableStyle.Grid ColumnStyles.Ad d(aColumnTextCo lumn)
' make the dataGrid use our new tablestyle and bind it to our
table
dataGrid1.Table Styles.Clear()
dataGrid1.Table Styles.Add(tabl eStyle)
Now, using a loop (for instance for i = 0 to 5 ...etc), can somebody show me
how to populate the grid ?
Thank you very much in advance


Nov 20 '05 #3
Hi Brett,

The datagrid looks when you go deeper in it almost special made for the
dataset
The webservice is completly optimized around using the XML dataset

Is there a special reason that you do not want to use the dataset?

It is just a container to hold tables.

Cor
Nov 20 '05 #4
Hi Cor,
yes. There is a reason. The webservice doesn't return a dataset.
It returns arrays of strings, or user type defined , or dates etc. Depending
on which one are called.

Depending on the records received, I need to display some icons on each
line. I also, need to "transform" certain user type defined field, to become
readable to the user.
A simple example is, the webservice send what supposed to be a date field in
the grid as "PS2004-15-01T04:56:42-8:00". So I would need to transform that.

Maybe there is a way to put the results of the web service into a dataset,
then just set the datasource of the datagrid to it ?

Thank you for you help again.

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OB******** ******@TK2MSFTN GP09.phx.gbl...
Hi Brett,

The datagrid looks when you go deeper in it almost special made for the
dataset
The webservice is completly optimized around using the XML dataset

Is there a special reason that you do not want to use the dataset?

It is just a container to hold tables.

Cor

Nov 20 '05 #5
Hi Brett,

A dataset is so easy to create here a sample I used today.

Maybe you can do something with it.

However if you have more questions feel free to ask.

Cor

\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim dt As New DataTable
Dim dc As New DataColumn("OHM ")
dc.DataType = GetType(System. Int32)
Dim dd As New DataColumn("OHH ")
dd.DataType = GetType(System. String)
dt.Columns.Add( dc)
dt.Columns.Add( dd)
For i As Integer = 0 To 11
dt.Rows.Add(dt. NewRow)
dt.Rows(i)(0) = 100
dt.Rows(i)(1) = "1"
Next
Dim ds As New DataSet
ds.Tables.Add(d t)
DataGrid1.DataS ource = ds.Tables(0)
End Sub
///
Nov 20 '05 #6
Hi Cor
I tried that solution. it works. But then I could find how to display an
icon in one the columns based on hte value for each rows.
Based on your example, how would you create a 3rd column that just display
an icon ?

Thank you again for your time.
I really appreciate it.
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:O3******** ******@TK2MSFTN GP09.phx.gbl...
Hi Brett,

A dataset is so easy to create here a sample I used today.

Maybe you can do something with it.

However if you have more questions feel free to ask.

Cor

\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim dt As New DataTable
Dim dc As New DataColumn("OHM ")
dc.DataType = GetType(System. Int32)
Dim dd As New DataColumn("OHH ")
dd.DataType = GetType(System. String)
dt.Columns.Add( dc)
dt.Columns.Add( dd)
For i As Integer = 0 To 11
dt.Rows.Add(dt. NewRow)
dt.Rows(i)(0) = 100
dt.Rows(i)(1) = "1"
Next
Dim ds As New DataSet
ds.Tables.Add(d t)
DataGrid1.DataS ource = ds.Tables(0)
End Sub
///

Nov 20 '05 #7
Here is an example that might help.

In the aspx page:

<asp:DataGrid ID="TheGrid" AutoGenerateCol umns=False Runat=server>
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:Image ImageUrl=<%# GetImageUrl(Con tainer.DataItem ) %>
Runat=server></asp:Image>
<%# GetText(Contain er.DataItem) %>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>

In the code behind:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim TheArray As ArrayList = New ArrayList
TheArray.Add(To day())
TheArray.Add("S omeString")
TheArray.Add(23 )
TheGrid.DataSou rce = TheArray
TheGrid.DataBin d()
End Sub

Protected Function GetImageUrl(ByV al InDataItem As Object) As String
If TypeOf InDataItem Is Date Then
Return "Date.gif"
ElseIf TypeOf InDataItem Is Integer Then
Return "Integer.gi f"
ElseIf TypeOf InDataItem Is String Then
Return "String.gif "
Else
Return "Unknown.gi f"
End If
End Function

Protected Function GetText(ByVal InDataItem As Object) As String
If TypeOf InDataItem Is Date Then
Return "Date"
ElseIf TypeOf InDataItem Is Integer Then
Return "Integer"
ElseIf TypeOf InDataItem Is String Then
Return "String"
Else
Return "Unknown"
End If
End Function

"Brett Sinclair" <lb*@nospam.com > wrote in message
news:uS******** ******@TK2MSFTN GP09.phx.gbl...
Ken,
There will be several "complex" format received.
The most common case will be an array list, which will be composed itself of columns strings, enum types, date or subarrays.

But for each line, I will display different icons based on the result
received.

Thanks for your help.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:Ob******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Brett what format is the data coming from the webservice in? You
can bind a datagrid to an collection or arraylist.

Ken
--------------------
"Brett Sinclair" <lb*@nospam.com > wrote in message
news:e9******** *****@tk2msftng p13.phx.gbl...
Hello everybody

I'm still on the learning curve here...and from what I read, I created
inherited datagrid class so I could have icons, combobox...etc in the
columns of my datagrid.

The grid will be used to populate information coming from a Webservice. (No
datasets - No datareaders).
So, I do not know see how to use the "datasource ".

Now I'm almost there...but I would need a little bit of help to
programatically populate the datagrid.

Here is , (I hope) a short code that I use. I create a grid with 3
columns.
the column 1 is a column with text + icon called DataGridIconTex tColumn inherited from the class of the same name.
the column 2 is a column with icon called DataGridIconOnl yColumn

inherited from the class of the same name. Depending on some "flag" I will be using 1
icon or another.
The column 3 is a regular DataGridTextBox Column
'load some icons from embedded resources
Me.Icons = New ImageList
Dim iconName As String
iconName = "datagridicons. user.ico"
Dim strm As System.IO.Strea m
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName) Dim icon As Icon
icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser1.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName) icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)
iconName = "datagridicons. IconUser2.ico"
strm = Me.GetType.Asse mbly.GetManifes tResourceStream (iconName) icon = New Icon(strm)
Me.Icons.Images .Add(icon.ToBit map)

Dim tableStyle As DataGridTableSt yle
tableStyle = New DataGridTableSt yle
tableStyle.Mapp ingName = "customers"

Dim numCols As Integer
numCols = 3

Dim iconColumn As DataGridIconTex tColumn
iconColumn = New DataGridIconTex tColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn.Head erText = "headercolu mn1"
iconColumn.Mapp ingName = "headercolu mn2"
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim iconColumn2 As DataGridIconOnl yColumn
iconColumn2 = New DataGridIconOnl yColumn(Me.Icon s, New
delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
iconColumn2.Hea derText = ""
iconColumn2.Map pingName = "Icon"
iconColumn2.Wid th = Me.Icons.Images (0).Size.Width
tableStyle.Grid ColumnStyles.Ad d(iconColumn)

Dim aColumnTextColu mn As DataGridTextBox Column
aColumnTextColu mn = New DataGridTextBox Column
aColumnTextColu mn.HeaderText = "headercolu mn3"
aColumnTextColu mn.MappingName = "headercolu mn3"
tableStyle.Grid ColumnStyles.Ad d(aColumnTextCo lumn)
' make the dataGrid use our new tablestyle and bind it to our table
dataGrid1.Table Styles.Clear()
dataGrid1.Table Styles.Add(tabl eStyle)
Now, using a loop (for instance for i = 0 to 5 ...etc), can somebody show me
how to populate the grid ?
Thank you very much in advance



Nov 20 '05 #8
Sorry - my previous answer is not very clear I think....

Hi Cor
I tried that solution at the beginning. It worked fine. But then I could not
find how to display an
icon in one the columns based on hte value for each rows.
That is why, I changed direction, and tried to create an inherited grid,
with an "iconcolumn " type in it. (see code in original post.)

Based on your example, how would you create a 3rd column that just display
an icon ?

Thank you again for your time.
I really appreciate it.

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:O3******** ******@TK2MSFTN GP09.phx.gbl...
Hi Brett,

A dataset is so easy to create here a sample I used today.

Maybe you can do something with it.

However if you have more questions feel free to ask.

Cor

\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim dt As New DataTable
Dim dc As New DataColumn("OHM ")
dc.DataType = GetType(System. Int32)
Dim dd As New DataColumn("OHH ")
dd.DataType = GetType(System. String)
dt.Columns.Add( dc)
dt.Columns.Add( dd)
For i As Integer = 0 To 11
dt.Rows.Add(dt. NewRow)
dt.Rows(i)(0) = 100
dt.Rows(i)(1) = "1"
Next
Dim ds As New DataSet
ds.Tables.Add(d t)
DataGrid1.DataS ource = ds.Tables(0)
End Sub
///

Nov 20 '05 #9
Hello Jeff
Thank you for your help. I'm not familiar with asp.net, but from what I can
see, is that at design time, you are able to define you column as "Image
ImageUrl".

In vb.net, I think (once again...I'm still learning) that the only type in a
datagrid is a DataGridTextBox Column.
I tried to use a datatable, datacolumn and datarow...but I have a same
problem. I can not add an icon to a datacolumn.

That is why I tried to create an inherited datagrid, where a column will
display an icon...but somehow I can not find the syntax now to loop thru the
records to populate that grid once I have defined each columns.

Thank you again for your help.


"Jeff" <no@email.org > wrote in message
news:ui******** *****@TK2MSFTNG P11.phx.gbl...
Here is an example that might help.

In the aspx page:

<asp:DataGrid ID="TheGrid" AutoGenerateCol umns=False Runat=server>
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:Image ImageUrl=<%# GetImageUrl(Con tainer.DataItem ) %>
Runat=server></asp:Image>
<%# GetText(Contain er.DataItem) %>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>

In the code behind:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim TheArray As ArrayList = New ArrayList
TheArray.Add(To day())
TheArray.Add("S omeString")
TheArray.Add(23 )
TheGrid.DataSou rce = TheArray
TheGrid.DataBin d()
End Sub

Protected Function GetImageUrl(ByV al InDataItem As Object) As String
If TypeOf InDataItem Is Date Then
Return "Date.gif"
ElseIf TypeOf InDataItem Is Integer Then
Return "Integer.gi f"
ElseIf TypeOf InDataItem Is String Then
Return "String.gif "
Else
Return "Unknown.gi f"
End If
End Function

Protected Function GetText(ByVal InDataItem As Object) As String
If TypeOf InDataItem Is Date Then
Return "Date"
ElseIf TypeOf InDataItem Is Integer Then
Return "Integer"
ElseIf TypeOf InDataItem Is String Then
Return "String"
Else
Return "Unknown"
End If
End Function

"Brett Sinclair" <lb*@nospam.com > wrote in message
news:uS******** ******@TK2MSFTN GP09.phx.gbl...
Ken,
There will be several "complex" format received.
The most common case will be an array list, which will be composed itself
of
columns strings, enum types, date or subarrays.

But for each line, I will display different icons based on the result
received.

Thanks for your help.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:Ob******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Brett what format is the data coming from the webservice in?

You can bind a datagrid to an collection or arraylist.

Ken
--------------------
"Brett Sinclair" <lb*@nospam.com > wrote in message
news:e9******** *****@tk2msftng p13.phx.gbl...
> Hello everybody
>
> I'm still on the learning curve here...and from what I read, I created > inherited datagrid class so I could have icons, combobox...etc in the > columns of my datagrid.
>
> The grid will be used to populate information coming from a Webservice. > (No
> datasets - No datareaders).
> So, I do not know see how to use the "datasource ".
>
> Now I'm almost there...but I would need a little bit of help to
> programatically populate the datagrid.
>
> Here is , (I hope) a short code that I use. I create a grid with 3
> columns.
> the column 1 is a column with text + icon called DataGridIconTex tColumn > inherited from the class of the same name.
> the column 2 is a column with icon called DataGridIconOnl yColumn

inherited
> from the class of the same name. Depending on some "flag" I will be

using
> 1
> icon or another.
> The column 3 is a regular DataGridTextBox Column
>
>
> 'load some icons from embedded resources
> Me.Icons = New ImageList
> Dim iconName As String
> iconName = "datagridicons. user.ico"
> Dim strm As System.IO.Strea m
> strm =

Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
> Dim icon As Icon
> icon = New Icon(strm)
> Me.Icons.Images .Add(icon.ToBit map)
> iconName = "datagridicons. IconUser1.ico"
> strm =

Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
> icon = New Icon(strm)
> Me.Icons.Images .Add(icon.ToBit map)
> iconName = "datagridicons. IconUser2.ico"
> strm =

Me.GetType.Asse mbly.GetManifes tResourceStream (iconName)
> icon = New Icon(strm)
> Me.Icons.Images .Add(icon.ToBit map)
>
> Dim tableStyle As DataGridTableSt yle
> tableStyle = New DataGridTableSt yle
> tableStyle.Mapp ingName = "customers"
>
> Dim numCols As Integer
> numCols = 3
>
>
>
> Dim iconColumn As DataGridIconTex tColumn
> iconColumn = New DataGridIconTex tColumn(Me.Icon s, New
> delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
> iconColumn.Head erText = "headercolu mn1"
> iconColumn.Mapp ingName = "headercolu mn2"
> tableStyle.Grid ColumnStyles.Ad d(iconColumn)
>
> Dim iconColumn2 As DataGridIconOnl yColumn
> iconColumn2 = New DataGridIconOnl yColumn(Me.Icon s, New
> delegateGetIcon IndexForRow(Add ressOf MyGetImageIndex ForRow))
> iconColumn2.Hea derText = ""
> iconColumn2.Map pingName = "Icon"
> iconColumn2.Wid th = Me.Icons.Images (0).Size.Width
> tableStyle.Grid ColumnStyles.Ad d(iconColumn)
>
> Dim aColumnTextColu mn As DataGridTextBox Column
> aColumnTextColu mn = New DataGridTextBox Column
> aColumnTextColu mn.HeaderText = "headercolu mn3"
> aColumnTextColu mn.MappingName = "headercolu mn3"
> tableStyle.Grid ColumnStyles.Ad d(aColumnTextCo lumn)
>
>
> ' make the dataGrid use our new tablestyle and bind it to our > table
> dataGrid1.Table Styles.Clear()
> dataGrid1.Table Styles.Add(tabl eStyle)
>
>
> Now, using a loop (for instance for i = 0 to 5 ...etc), can somebody

show
> me
> how to populate the grid ?
> Thank you very much in advance
>
>



Nov 20 '05 #10

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

Similar topics

2
9927
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
0
3645
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
9
8854
by: Eric S. | last post by:
Why doesn't something like this work? I get "a constant value is expected" on all 3 case statements. private DataGrid CurrentDataGrid(DataGrid firstDg, DataGrid secondDg) { try { switch (true) { case firstDg.Items.Count != 0 & secondDg.Items.Count != 0:
2
1926
by: Richard | last post by:
DataGrid Row Second Row Selected. How do I not show that blank row with the > abc abc abc abc > abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc xx yyyyyyyyyyyyyy
6
3308
by: Andreas Klemt | last post by:
Hello, I have this Public Structure strucUser Dim userIDAs Integer Dim firstnameAs String Dim lastname As String End Structure Dim collectUser As New Collection
2
2061
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP (non-.Net) if I wanted to fill a list it may look something like this: -------START CODE <%
2
1770
by: Nina | last post by:
Hi there, I've tried everything that I know to prevent usre resizing datagrid columns, but nothing works. Following are the code that I used. Please tell me what's wrong with them. Thank you. P.S.: dg is datagrid Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
1
1261
by: Coleen | last post by:
To export data from a datagrid to an excel file. I am using VB.net/ASP.net v 2003, and not connecting to an SQL database. I have an existing datagrid that I want to get the data from and download it to an excel file. Mrozu was kind enough to send me some code (thank you) - unfortunately it does not work - it gives me an error "Cannot create ActiveX component." which he says is due to not having Excel installed on my machine. I DO have...
2
6596
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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...
0
9946
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
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.