Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Dynamically define variables in VB.Net/ASP.Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SV - 20 May 2008 08:31 GMT
Hi there,

I am using ASP.Net 2.0 with VB.Net.

I want to define variables. For example I want to create variable of
type TableRow and while defining I don't know how many rows i needed.
So what i want to do in my code:

For i As Integer = 0 To dt.Tables(0).Rows.Count - 1
    dim tr_i as New TableRow

    ' other code.....

Next i

But it will define variable as tr_i...but i want tr_0,
tr_1,tr_2,.........

Is it possible?

Thanks,

SV
Eliyahu Goldin - 20 May 2008 09:26 GMT
It is possible that you are not exactly on the right track. What do you want
to achieve?

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> Hi there,
>
[quoted text clipped - 19 lines]
>
> SV
Patrice - 20 May 2008 09:44 GMT
This is called an Array. I would suggest to read at least once the language
specification so that you have an idea of what you have at your disposal...

You may want also to explain what you are trying to do (This is a datarow,
not a tablerow, you can browse each row using for each. You already have
this array using dt.Tables(0).Rows(i) etc....)

--
Patrice

"SV" <swetavyas@gmail.com> a écrit dans le message de groupe de discussion :
894d04a4-258c-47e4-8503-817e0bc5e4c6@y18g2000pre.googlegroups.com...
> Hi there,
>
[quoted text clipped - 19 lines]
>
> SV
Mark Rae [MVP] - 20 May 2008 11:28 GMT
> Is it possible?

As others have mentioned, dynamic variables are possible in .NET but are
generally considered to be poor programming practice.

There will almost certainly be much more efficient methods - can you explain
a bit more about what you're trying to do...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

SV - 21 May 2008 05:15 GMT
Thanks all for your replies.

I think I was not able to explain you very well. But I tried to do the
things using arrays but didn’t get exactly what I want.
Anyways, I have solved the problem.

I really appreciate your precious replies.
Thanks.

> > Is it possible?
>
[quoted text clipped - 7 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net
Juan T. Llibre - 21 May 2008 11:53 GMT
re:
!> Anyways, I have solved the problem

It could help others if you posted the solution you arrived at.
Sharing information like that is the very purpose of these newsgroups.

Can you ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
Thanks all for your replies.

I think I was not able to explain you very well. But I tried to do the
things using arrays but didn’t get exactly what I want.
Anyways, I have solved the problem.

I really appreciate your precious replies.
Thanks.

> "SV" <swetav...@gmail.com> wrote in message
>
[quoted text clipped - 11 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.