Populate dataset with dummy values

  • Thread starter Thread starter yajames2002
  • Start date Start date
Y

yajames2002

Hi.

I'm trying to hard code a dataset with dummy values so that I can bind
the dataset to a repeater.

I'm doing this so that I can design the gui without having access to
the data that will eventually populate the repeater object.

All I know at initial design time is the display names of the columns
I'll be populating with.

So... is it possible to assign values to a dataset eg. strings, rows
so that I can assign the dataset as the "DataSource" of my repeater?

Thanks in advance to the positive replies.
 
Hiyas

Not quite sure what you mean, but yes you can fill in dummy values in a
dataset.
If you load the dataset in the window that will be displaying it you can add
a call to a method/sub called InitializeDS in the New method of the window
(where it says you can add your own code. Then make the method InitializeDS
with something similar to this:
Dim rand As New Random
Dim index As Integer
For index=0 To 50
ds.Tables(0).Rows.Add(New Object() {"Whatever "&index, rand.Next, New
Date(rand.Next)})
Next

Just repeat that as needed for each table, and with the proper types in the
proper places of course. You *could* make a randomizer that works on any
schema but that would take much longer than it would to just make a number
of For sections (using Table.Columns and DataSet.Relations). If you want the
dataset to always be the same then just give the Random class a fixed seed.

Hope that helps
/Dan
 
Back
Top