Results 1 to 4 of 4

Thread: Button Control in VB .NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    5

    Button Control in VB .NET

    Hi,

    I wan to create dynamic button control in VB .NET. Is it possible. I am writing the following code but it doesnt show any button on the web page. Any input on what I may be doing wrong is welcome. "I Do not want to drag and drop a button on webform1.aspx page, I want to create a button using webform1.aspx.cs page.

    Thanks
    Abhijit

    :

    Public Class WebForm1
    Inherits System.Web.UI.Page


    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents Button2 As System.Web.UI.WebControls.Button
    'Protected WithEvents a As AxSpreadsheet

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Button2 = New Button
    Button2.EnableViewState = True
    Button2.Text = "Abhijit"
    Button2.Visible = True
    Button2.Enabled = True
    End Sub

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    5

    Re: Button Control in VB .NET

    Why does this question have a tick sign against it in the rating? Could anyone throw some light on it?

    Thanks
    Abhijit

  3. #3
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: Button Control in VB .NET

    The tick sign indicates you are "subscribed" to this thread, thats is if you have the email featured turned on, then you would get an mail when someone replies to this thread.


    Now the question:

    Code:
     Dim objTextBox As New TextBox
            objTextBox.Text = "Some Value"
            objTextBox.Visible = True
            Panel1.Controls.Add(objTextBox)
    'Where Panel1 is a panel inside the form tags

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: Button Control in VB .NET


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width