Control arrays

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abhiraj Chauhan
    New Member
    • Oct 2008
    • 19

    Control arrays

    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

    Code:
      Select Case Index
                Case 0
                    EntryOption = 0
                Case 1
                    EntryOption = 1
            End Select
    
    
       If EntryOption = 0 Then
                ds = CurDb.OpenRecordset("PlinthBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset)
            Else
                If EntryOption = 1 Then
                    ds = CurDb.OpenRecordset("FloorBeamData", DAO.RecordsetTypeEnum.dbOpenDynaset)
                End If
    Last edited by kenobewan; Oct 10 '08, 01:19 PM. Reason: Use code tags
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    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:
    [code=vb.net]
    Dim mycontrolarray As somecontrolType () = New somecontrolType (9) {}
    [/code]
    None of those controls are instanciated yet, so you would have to say like:
    [code=vb.net]
    mycontrolarray( 0) = New somecontrolType ()
    [/code]

    As for why they dropped it, I'm still wondering why they continued VB at all :-P

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by Plater
      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

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Originally posted by Frinavale
        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?
        [code=vb.net]
        If Index =0 Then
        ds = CurDb.OpenRecor dset("PlinthBea mData", DAO.RecordsetTy peEnum.dbOpenDy naset)
        ElseIf Index= 1 Then
        ds = CurDb.OpenRecor dset("FloorBeam Data", DAO.RecordsetTy peEnum.dbOpenDy naset)
        End If
        [/code]

        Comment

        • Abhiraj Chauhan
          New Member
          • Oct 2008
          • 19

          #5
          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...
          [code=vbnet]
          Dim ds As DAO.Recordset

          Select Case Index
          Case 0
          EntryOption = 0
          Case 1
          EntryOption = 1
          End Select
          Data_Gr.Refresh ()
          Data_Gr.Row = 1
          For i = 0 To 4
          Data_Gr.Col = i
          Data_Gr.Text = ""
          Next
          Data_Gr.Rows = 2
          DataToGrid()
          If EntryOption = 0 Then
          ds = CurDb.OpenRecor dset("PlinthBea mData", DAO.RecordsetTy peEnum.dbOpenDy naset)
          Else
          If EntryOption = 1 Then
          ds = CurDb.OpenRecor dset("FloorBeam Data", DAO.RecordsetTy peEnum.dbOpenDy naset)
          End If
          End If[/code]
          Last edited by Frinavale; Oct 11 '08, 03:43 PM. Reason: added [code] tags

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            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.

            Comment

            • Abhiraj Chauhan
              New Member
              • Oct 2008
              • 19

              #7
              Originally posted by Plater
              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

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                Unless radiobuttons are grouped together, they will each register a different value.
                Are you sure that "Index" is ever changing in this code:
                [code=vbnet]
                Select Case Index
                Case 0
                EntryOption = 0
                Case 1
                EntryOption = 1
                End Select
                [/code]
                Have you set a breakpoint and stepped though your code?

                Comment

                Working...