473,568 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Runtime Array and DataTable with VB.NET

Hi everyone,

I have 5 string in my array that I get from MS Access DB.
Public mDov(0) as string and I fill with my for loop. The result as shown
below

mDov(0) = "ABC_01"
mDov(1) = "ABC_02"
mDov(2) = "ABC_03"
mDov(3) = "ABC_04"
mDov(4) = "ABC_05"

Now I need to create 5 Public type DataTable and the each table name based
on the above strings.

How to I create in runtime 5 DataTable (in future might be more) as:

Public Shared tbl_ABC_01 as DataTable
Public Shared tbl_ABC_02 as DataTable
Public Shared tbl_ABC_03 as DataTable
Public Shared tbl_ABC_04 as DataTable
Public Shared tbl_ABC_05 as DataTable

As you can see the Table name came from above array.

I also need to crate runtime string array and each array name based on the
above strings. But I don't know how?

I appricate your kind help and reading my post.

Thank you.

Rgds,
Niyazi
Jul 19 '06 #1
2 2012
Hi Niyazi,

If you don't know how many tables and their names at design time, then you
cann not code it the way you want. You could have an array of datatables,
with a number of items that is determinded at runtime. For example :

declaration like this:
Public shared tblABC() as datatable

dimensios assigned like this, after mDov is retrieved from your database:
ReDim tblABC(mDov.Get Length(0)-1)

Hope this helps,

Joris

"Niyazi" wrote:
Hi everyone,

I have 5 string in my array that I get from MS Access DB.
Public mDov(0) as string and I fill with my for loop. The result as shown
below

mDov(0) = "ABC_01"
mDov(1) = "ABC_02"
mDov(2) = "ABC_03"
mDov(3) = "ABC_04"
mDov(4) = "ABC_05"

Now I need to create 5 Public type DataTable and the each table name based
on the above strings.

How to I create in runtime 5 DataTable (in future might be more) as:

Public Shared tbl_ABC_01 as DataTable
Public Shared tbl_ABC_02 as DataTable
Public Shared tbl_ABC_03 as DataTable
Public Shared tbl_ABC_04 as DataTable
Public Shared tbl_ABC_05 as DataTable

As you can see the Table name came from above array.

I also need to crate runtime string array and each array name based on the
above strings. But I don't know how?

I appricate your kind help and reading my post.

Thank you.

Rgds,
Niyazi

Jul 19 '06 #2
Hi Joris,

Sorry for my late post. I had some busy schedule with family. I thank you
for your kind help an yes it did the job that I was looking for.

Thank you.

Rgds,
GC

"Joris Zwaenepoel" wrote:
Hi Niyazi,

If you don't know how many tables and their names at design time, then you
cann not code it the way you want. You could have an array of datatables,
with a number of items that is determinded at runtime. For example :

declaration like this:
Public shared tblABC() as datatable

dimensios assigned like this, after mDov is retrieved from your database:
ReDim tblABC(mDov.Get Length(0)-1)

Hope this helps,

Joris

"Niyazi" wrote:
Hi everyone,

I have 5 string in my array that I get from MS Access DB.
Public mDov(0) as string and I fill with my for loop. The result as shown
below

mDov(0) = "ABC_01"
mDov(1) = "ABC_02"
mDov(2) = "ABC_03"
mDov(3) = "ABC_04"
mDov(4) = "ABC_05"

Now I need to create 5 Public type DataTable and the each table name based
on the above strings.

How to I create in runtime 5 DataTable (in future might be more) as:

Public Shared tbl_ABC_01 as DataTable
Public Shared tbl_ABC_02 as DataTable
Public Shared tbl_ABC_03 as DataTable
Public Shared tbl_ABC_04 as DataTable
Public Shared tbl_ABC_05 as DataTable

As you can see the Table name came from above array.

I also need to crate runtime string array and each array name based on the
above strings. But I don't know how?

I appricate your kind help and reading my post.

Thank you.

Rgds,
Niyazi
Jul 24 '06 #3

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

Similar topics

5
1295
by: jon morgan | last post by:
Hi, I am trying to clean out all the VB specific code in a project before porting to C#. Having removed all the import references I still see the VB runtime is loaded at startup. How can I pin down what is actually causing the VB runtime still to load? Thanks for any help.
0
2391
by: Chankama | last post by:
Hi. I am making an application using the Compact Framework for a PPC. Essentially what I am trying to do is, read a table from a external datasource, and try to display it using the datagrid. For my purposes, I can't use DataTable and DataSet, etc. etc. ie. So I am implementing iTypedList. To put it simply, I need to override the 'Count'...
5
1905
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2; // ... public static MyObject Object400;
4
5017
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to do it? I can bind data to datagrids and lists and stuff all day long, but can't seem to grasp this one. Any pointers to a useful article / demo (or...
5
2645
by: Gary Blakely | last post by:
I'm giving this post another try - it can't be too difficult for everyone.... In the program below, the web page has dataGrid1. the only thing that has been done to it at design time is to check the "Create columns automatically at runtime" checkbox - nothing else. The code below does indeed create the visual grid as expected. ...
9
17702
by: Rui Sampainho | last post by:
Hi Is there any command to transfer the contents of a datatable to an array. What I'm looking for is sort of a bulk process, not an iteration with a loop based on a field by field or row by row process. Regards RMS
5
1671
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't this in essence a table i.e. a collection of rows? The reason I ask is that I wanted to extract from the array of rows
6
2344
by: Paulers | last post by:
Hello, I have a string that I am trying to add each char to a datatable row. for example if I have a string that looks like "abcdefg", I would like to break it up into an array of characters so I can do this: myDataTable.Rows.Add(array()) instead of myDataTable.Rows.Add("a","b","c","d","e","f","g")
2
3740
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error when i do the following. if you add a contact with up to 13 fields it will be stored in a data structure. i have a tabbed pane that will show six of...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
0
3651
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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...

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.