Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. help - Control Array and Refer to the control in KeyDown events in VB.net

help - Control Array and Refer to the control in KeyDown events in VB.net

Scheduled Pinned Locked Moved Visual Basic
helpcsharpdatabasedata-structures
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gilbertlow
    wrote on last edited by
    #1

    plz help.... I used to use control array in vb which is currently not support by vb .net. For example, if i have 5 text box and make it as control array of text(0), text(1)...text(4) to refer to respective text control. what happen is i have a problem of refering to the control in the form when the control having the focus by press the f3 key to call the lookup windows...in vb .net. Attached with sample code for your reference and understanding in VB. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) With ActiveControl Select Case KeyCode Case vbKeyF3 Select Case .Name Case "text" Select Case .Index Case cozsys_textbox0 If Lookup("select zsys_comid as Company_ID, " & _ "zsys_comnm as Company_Name, " & _ "zsys_regno as Register_No " & _ "from zsys order by zsys_comid") Then .Text = LookupFields("Company_ID") Case cozsys_textbox1 Case cozsys_textbox2 Case cozsys_textbox3 End If End Select text(.Index).SetFocus text(.Index).DataChanged = False End Select End Select End With End Sub where cozsys_textbox0, cozsys_textbox1, cozsys_textbox2, cozsys_textbox3 is the array index for text box 1 to 4 How could we refer the control array in the calling Private Sub form1_KeyDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown in vb .net. Please help me ? Any other methods ? Thank you very much Gilbert

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups