473,491 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Control arrays

19 New Member
i am new to vb.net......i have two radio buttons associated with msflexgrid version 6 in vb.net ..can any body help me out how can i create control array...In vb6.0 it was it was ** easy ....but i don't why MS decided to drop this facility from VB.net... In vb 6.0 it was like this

Expand|Select|Wrap|Line Numbers
  1.   Select Case Index
  2.             Case 0
  3.                 EntryOption = 0
  4.             Case 1
  5.                 EntryOption = 1
  6.         End Select
  7.  
  8.  
  9.    If EntryOption = 0 Then
  10.             ds = CurDb.OpenRecordset("PlinthBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset)
  11.         Else
  12.             If EntryOption = 1 Then
  13.                 ds = CurDb.OpenRecordset("FloorBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset)
  14.             End If
Oct 10 '08 #1
7 1364
Plater
7,872 Recognized Expert Expert
Well, you could drop the msflexgrid, and use one of the actual .NET components, that would make life a lot easier.

What exactly are you trying to make an array of? I saw no array code in the source code you posted. Just a poorly constructed CASE/IF statement.

Its very easy to make arrays in .NET:
Expand|Select|Wrap|Line Numbers
  1. Dim mycontrolarray As somecontrolType() = New somecontrolType(9) {} 
  2.  
None of those controls are instanciated yet, so you would have to say like:
Expand|Select|Wrap|Line Numbers
  1. mycontrolarray(0) = New somecontrolType() 
  2.  
As for why they dropped it, I'm still wondering why they continued VB at all :-P
Oct 10 '08 #2
Frinavale
9,735 Recognized Expert Moderator Expert
As for why they dropped it, I'm still wondering why they continued VB at all :-P
You can't just get rid of something once it's been used for vast amounts of applications (even though I find myself wonder why VB was designed they way it was...)

Anyways, are you attempting to make an array based on the data retrieved from the record set?

I'm also confused as to how arrays fit into your question.

-Frinny
Oct 10 '08 #3
Plater
7,872 Recognized Expert Expert
You can't just get rid of something once it's been used for vast amounts of applications
Sure you can, its known as "progress". I'm wiping stuff out of my applications that I have had in for like 2years now, because I don't like it. Time for the axe.


Why not use this?
Expand|Select|Wrap|Line Numbers
  1. If Index =0 Then
  2.    ds = CurDb.OpenRecordset("PlinthBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset) 
  3. ElseIf Index= 1 Then 
  4.    ds = CurDb.OpenRecordset("FloorBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset) 
  5. End If 
  6.  
Oct 10 '08 #4
Abhiraj Chauhan
19 New Member
Well....Thank u for replying........I can't drop msflex grid as i had used it in my whole project...n ...i don't understand when you say why are they continuing with Vb As far as i think VB is like Trynasouras Rex in the field of Languages.....I have two Radio buttons..i want when i click 1st option the data in the datagrid fits in the plinth beam table n when 2nd option is clicked data fits in Floorbeam table.....n code for both radio buttons is...
Expand|Select|Wrap|Line Numbers
  1.  Dim ds As DAO.Recordset
  2.  
  3.     Select Case Index
  4.             Case 0
  5.                 EntryOption = 0
  6.             Case 1
  7.                 EntryOption = 1
  8.         End Select
  9.         Data_Gr.Refresh()
  10.         Data_Gr.Row = 1
  11.         For i = 0 To 4
  12.             Data_Gr.Col = i
  13.             Data_Gr.Text = ""
  14.         Next
  15.         Data_Gr.Rows = 2
  16.         DataToGrid()
  17.         If EntryOption = 0 Then
  18.             ds = CurDb.OpenRecordset("PlinthBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset)
  19.         Else
  20.             If EntryOption = 1 Then
  21.                 ds = CurDb.OpenRecordset("FloorBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset)
  22.             End If
  23.         End If
Oct 11 '08 #5
Plater
7,872 Recognized Expert Expert
Ok, so when radiobutton1 is selected, do task1 and when radiobutton2 is selected do task2.
I'm not sure I still see any problem?


And yes, it is like the TRex, clumsy, partially-blind and short armed. But thats a personal opinion, hehe.
Oct 13 '08 #6
Abhiraj Chauhan
19 New Member
Ok, so when radiobutton1 is selected, do task1 and when radiobutton2 is selected do task2.
I'm not sure I still see any problem?


And yes, it is like the TRex, clumsy, partially-blind and short armed. But thats a personal opinion, hehe.

Actually Data is going only in Plinth Table whether i select Ist option or 2nd option...this is my problem..n now it seems that i m going to pull my hair.....my codes are right but what is the prob i don't know.......

n also this short armed VB is vry dangerous....he he
Oct 14 '08 #7
Plater
7,872 Recognized Expert Expert
Unless radiobuttons are grouped together, they will each register a different value.
Are you sure that "Index" is ever changing in this code:
Expand|Select|Wrap|Line Numbers
  1. Select Case Index 
  2.             Case 0 
  3.                 EntryOption = 0 
  4.             Case 1 
  5.                 EntryOption = 1 
  6.         End Select 
  7.  
Have you set a breakpoint and stepped though your code?
Oct 14 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
18587
by: RBohannon | last post by:
Is it possible to create a control array on an unbound form? I would like to be able to loop through a series of unbound text boxes. Thanks.
13
1574
by: Bernie | last post by:
Sorry, but this ia another whine about VB.Net's lack of Control Arrays. I am new to VB.Net and I'm building an application that uses variable number of Label controls that are created at run...
2
1324
by: Merlin | last post by:
Hi I have a control that allows embeddable editors, so for example I can set a property of controlsEmbeddableEditor =me.TextBox1 on my form, no problem here - what I want to do is the same thing...
3
3835
by: B-Dog | last post by:
I'm capturing the checked radio button to XML file using the name of the radio button. I want to read my xml file to find which button was checked on close and the check the appropriate button...
3
1378
by: Robert | last post by:
How can I declare in VB .NET an array of labels for example and afterwards using a FOR structure load every component of the array? I've used this code but it doesn't work: dim x(10) as label...
20
2355
by: samean | last post by:
Hello, Could you explain me,In VB6 using control array,and how about VB.net. Thanks
8
2293
by: Greg | last post by:
In VB6 I made heavy use of control arrays I see they have been 'deprecated' in vb.Net, with a questionable explanation that they are no longer necessary which just addresses the event issue!...
9
5479
by: Michael D. Ober | last post by:
In VB 6, you can create control arrays for your option groups and scan with the following code dim opt as OptionButton for each opt in OptionGroup ' Do something next opt I know VB 2005...
4
2575
by: Arne Beruldsen | last post by:
I'm a recent convert to VB.net from VB6...and I can't believe they don't support control arrays. I have an app that uses a ton of Control Arrays...mostly labels and text boxes. I need some...
13
1661
by: Just_a_fan | last post by:
I am adding a bunch of controls with the code below. Problem 1: When program flow passes to "UpperChanged" when I click it, the control name is undefined. When I enter: If udUpperLim1.Value 1...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
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,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4886
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...
0
3087
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
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 ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
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...

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.