Avatar of MPKR
MPKR
Flag for Germany asked on

Howto SHOW Data on Windows Form?

Hi there,

I have tried for hours now. I am reading a MS Press book and understood what Dataset, Dataadapter, DAtatables... are.

But I can't manage to SHOW any Data stored on my SQL Server on my windows Form.

The Dataadapter fills my Dataset.
            Dim ds As New DataSet
            da_Asset.Fill(ds)

The Data is there, shown in the dataadapter Preview!

But what kind of control do I have to use for SHOWING that stuff to the user of my Form???? Is .NET that terribly complicated??

I have tried Dataviews or Datagrids but I can't realize it. The book does not help and I can't find just one simple example...!

MP
Visual Basic.NET

Avatar of undefined
Last Comment
MPKR

8/22/2022 - Mon
Howard Cantrell

Hi,

Here is where I found good examples for getting started in VB.Net

.....http://msdn.microsoft.com/vbasic/downloads/samples/101samples.aspx

Link for ASP programs...

http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx 

iboutchkine

Add datagrid to the form and then

Datagrid1.DataSource = da_Asset


that's all
MPKR

ASKER
That doesn't work.

da_asset is an adapter in this case.

So far I feel I can pass only dataset.Tables(x) to Datagrids.Datasource. Right?
Your help has saved me hundreds of hours of internet surfing.
fblack61
iboutchkine

Sorry it must be dataset

Datagrid1.DataSource = ds
MPKR

ASKER
ok. Thanks. I am getting more and more certain.

One more question:

I have added some DataAdapters to my Form.
I have created a Dataset inside code while runtime.

I fill the Dataset with the Data from different Dataadapters while runtime like that:

da1.Fill(DSet)
datagrid1.DataSource = DSet.Tables(0)
'WORKS!

da2.Fill(DSet)
dgatagrid2.DataSource = DSet.Tables(1)
'WORKS!

da3.Fill(DSet)
'DSet.Tables.Add()                                  <= that does work only if I add this Line!!??!! WHY?
datagrid3.DataSource = DSet.Tables(2)

Why does it work without adding a Table to the Dataset twice and does NOT work when adding a third Table?
Why must I add the third Table manually to the Dataset??

Thanks,
MP





iboutchkine

Because probably initially you have only 2 tables in the dataset. When you adding the third table you can display it. How many datatables do you have in your dataset?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
MPKR

ASKER
Meanwhile I have added pu to 8 Tables because I want to show different data on 8 datagrids.
Do I really have to administrate those tables and their numbers.
For example when adding a new table (no 9) I have to

add a table
fill the table

And whenever I want to access this specific table I have to adress ds.tables(8) e.g. to print the data inside...
I know I could use names for my Tables, but that seems not to make it much easier.
Im I going a wrong way?
ASKER CERTIFIED SOLUTION
iboutchkine

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MPKR

ASKER
Thank you for your help!