Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 618319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:31:56+00:00 2026-05-13T18:31:56+00:00

Hi I’m still quite new to VB.NET… I have the following code for a

  • 0

Hi I’m still quite new to VB.NET…
I have the following code for a form that has a button (Button1).
When I press this button it adds a combobox with some values (it adds a new one underneath each time the button is pushed).
How do I set up and event so that when a combobox is changed, a textbox will appear to the right of it?
I’m basically looking at having different behaviors based on what is selected in each combobox.

Public Class frmEditor
    Private Const rowHeight = 25
    Dim datarows() As Action
    Dim currentrow As Integer
    Dim starttop As Integer
    Private Sub frmEditor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        currentrow = 1
        starttop = 20
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        CreateRow()
        currentrow = currentrow + 1
        starttop = starttop + rowHeight
    End Sub

    Private Sub CreateRow()
        Dim newrow As Action = New Action()
        ReDim Preserve datarows(currentrow)
        datarows(currentrow) = newrow
        datarows(currentrow).newAction(15, starttop, currentrow)
    End Sub

End Class

Public Class Action
    Private cbo As New ComboBox()

    Public Sub newAction(ByVal xleft As Integer, ByVal ytop As Integer, ByVal nrow As Integer)
        cbo.Top = ytop
        cbo.Left = xleft
        cbo.Visible = True
        cbo.Items.Add("Test1")
        cbo.Items.Add("Test2")
        frmEditor.Controls.Add(cbo)

    End Sub
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:31:56+00:00Added an answer on May 13, 2026 at 6:31 pm

    You need to add a handler

    AddHandler cbo.newAction, AddressOf newAction
    

    EDIT:

    Here is an example of something I built. I wanted to be able to add a row of links to the bottom of every page without having to add the HTML to each page. So I built a control to do it for me. Part of it was to add a LoginStatus control

            Protected Overrides Sub CreateChildControls()
               Dim lb As New LoginStatus
               With lb
                   .ID = "LoginStatus1"
                   AddHandler .LoggingOut, AddressOf LoginStatus1_LoggingOut
               End With
               Me.Controls.Add(lb)
            End Sub
    

    Then my LoggingOut handler does a little magic as to not break my URLRewriting.

            Private Sub LoginStatus1_LoggingOut(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)
            'sign out the logged in user
            End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.