Hello,

I have a windows.forms application in VB.NET which has a DataGrid. I
started simple and so programmed the Grid to appear by Default when the
application opened and show a default dataSet. Now that I have done this I
want to extend the program's capabilities.

Instead of one dataSet I have 6 ( dataSetxxx, dataSetyyy, etc) and a listbox
with 6 items in( xxx, yyy, etc)

I populated the Listbox by...

me.listbox.items.add("xxx") and so on

When the application opens I want to show a picture but when the user
selects one of the options from the ListBox, the corresponding dataSet is
shown in the DataGrid form.
All the dataSets are in XML format.

I'm pretty new to VB.NET and have tried all sorts of different ways of doing
this without any success.

Can anyone help?

Can someone tell me how to make the cells in the dataSet readonly?

Thanks in advance,

James

Re: DataGrids, Datasets and ListBoxes by Sijin

Sijin
Fri Nov 05 01:37:21 CST 2004

1. When the item is selected from the listbox, you need to determine the
dataset that has to be shown to the user.

2. Pass that dataset to the datagrid form, either in the constructor or
by having the datagrid form implement a public property that will be set
by the parent form.

3. In the datagrid formbind the datagrid to the provided dataset.

4. Use DataTable.DefaultView.AllowEdit = false to make the datagrid
readonly.

If you have some code i could help you tweak it to get it working.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

James Batley wrote:
> Hello,
>
> I have a windows.forms application in VB.NET which has a DataGrid. I
> started simple and so programmed the Grid to appear by Default when the
> application opened and show a default dataSet. Now that I have done this I
> want to extend the program's capabilities.
>
> Instead of one dataSet I have 6 ( dataSetxxx, dataSetyyy, etc) and a listbox
> with 6 items in( xxx, yyy, etc)
>
> I populated the Listbox by...
>
> me.listbox.items.add("xxx") and so on
>
> When the application opens I want to show a picture but when the user
> selects one of the options from the ListBox, the corresponding dataSet is
> shown in the DataGrid form.
> All the dataSets are in XML format.
>
> I'm pretty new to VB.NET and have tried all sorts of different ways of doing
> this without any success.
>
> Can anyone help?
>
> Can someone tell me how to make the cells in the dataSet readonly?
>
> Thanks in advance,
>
> James