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. moving a button

moving a button

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
4 Posts 3 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
    GaryKoh
    wrote on last edited by
    #1

    hello i wish program a button that will move another button to a specific location i try to make it more simple there are 2 buttons A & B when button A is pressed, button B will move away from button A so that button A's sub button could be display i can manage the sub button part but was unable to move button B to a specific location because i dont know the coding that will do the task can you please help me? if this type of program or coding is impossible, please tell me, so i can drop my intention to do this function. thank you in advance p.s. below is a visual example of the thing i wish to do "before button A is clicked" Button A Button B "after button A is clicked" Button A Button B Gary

    J E 2 Replies Last reply
    0
    • G GaryKoh

      hello i wish program a button that will move another button to a specific location i try to make it more simple there are 2 buttons A & B when button A is pressed, button B will move away from button A so that button A's sub button could be display i can manage the sub button part but was unable to move button B to a specific location because i dont know the coding that will do the task can you please help me? if this type of program or coding is impossible, please tell me, so i can drop my intention to do this function. thank you in advance p.s. below is a visual example of the thing i wish to do "before button A is clicked" Button A Button B "after button A is clicked" Button A Button B Gary

      J Offline
      J Offline
      Jay Shankar
      wrote on last edited by
      #2

      I do not syntax of VB.Net, but in C# the above can be done as below

      this.button2.Location = new Point(this.button2.Location.X, this.button2.Location.Y + 10);

      Read about the Location Property of the class System.Windows.Forms.Button on msdn, This property is being inherited from Control. You get all relevent details. Best of luck. Regards, Jay

      1 Reply Last reply
      0
      • G GaryKoh

        hello i wish program a button that will move another button to a specific location i try to make it more simple there are 2 buttons A & B when button A is pressed, button B will move away from button A so that button A's sub button could be display i can manage the sub button part but was unable to move button B to a specific location because i dont know the coding that will do the task can you please help me? if this type of program or coding is impossible, please tell me, so i can drop my intention to do this function. thank you in advance p.s. below is a visual example of the thing i wish to do "before button A is clicked" Button A Button B "after button A is clicked" Button A Button B Gary

        E Offline
        E Offline
        Ehmed Owais
        wrote on last edited by
        #3

        dear gary it is very simple in .net. if i would have been at your place i should do it in this manner. place button A then place a textbox with multiline property set to be true also make it invisible now put a new button button B. leave it i m giving you the entire code use it and remember me in your prayers. Public Class FrmMoveButton Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Button2 As System.Windows.Forms.Button Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.TextBox1 = New System.Windows.Forms.TextBox Me.Button2 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(4, 14) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(112, 28) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(6, 44) Me.TextBox1.Multiline = True Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(110, 48) Me.TextBox1.TabIndex = 1 Me.TextBox1.Text = "please provide co-ordinates in (x,y) format dont forget paranthasis" Me.TextBox1.Visible = False ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(6, 44) Me.Button2.Name

        G 1 Reply Last reply
        0
        • E Ehmed Owais

          dear gary it is very simple in .net. if i would have been at your place i should do it in this manner. place button A then place a textbox with multiline property set to be true also make it invisible now put a new button button B. leave it i m giving you the entire code use it and remember me in your prayers. Public Class FrmMoveButton Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Button2 As System.Windows.Forms.Button Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.TextBox1 = New System.Windows.Forms.TextBox Me.Button2 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(4, 14) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(112, 28) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(6, 44) Me.TextBox1.Multiline = True Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(110, 48) Me.TextBox1.TabIndex = 1 Me.TextBox1.Text = "please provide co-ordinates in (x,y) format dont forget paranthasis" Me.TextBox1.Visible = False ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(6, 44) Me.Button2.Name

          G Offline
          G Offline
          GaryKoh
          wrote on last edited by
          #4

          wow.... thanks ehmed..i will dream hahaha sorry for the late reply.... my motherboard got fried i will try out this code thanks again Gary

          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