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 8758251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:29:47+00:00 2026-06-13T14:29:47+00:00

I have come across an issue that has completely bamboozled me. I have a

  • 0

I have come across an issue that has completely bamboozled me.

I have a dynamically added DataGridView with many columns and rows and what I am trying to achieve is on mouse_up I want a button to be drawn over the selected cells. So for example if I select the first 3 cells of row3, a button should be drawn over the 3 cells.

I have tried using the X and Y of each selected cell and convert it to a buttoncolumn but that didn’t work. What I currently have is sample code that just adds button to the screen but they do not appear on the screen (thus the title). Once I get the buttons to appear on the screen I will then try to draw them over the selected cells but I need to get over this hurdle first

This is the code I am using:

    'I dynamically add the DataGridView
    Grid = New DataGridView
    Grid.Dock = DockStyle.Fill
    Grid.BackgroundColor = Color.White
    Grid.RowHeadersVisible = False
    Grid.AllowUserToOrderColumns = False
    Grid.AllowUserToResizeRows = False

    ...

    TabControl.SelectedTab.Controls.Add(Grid)

    AddHandler Grid.CellMouseUp, AddressOf Grid_MouseUp

    ...
   'On mouse up it calls the sub to add buttons
    Private Sub Grid_MouseUp(ByVal sender As Object, ByVal e As         System.Windows.Forms.DataGridViewCellMouseEventArgs)

    Dim i As Integer

    For i = 1 To 30
        NewButton(i) 'calls the dub
    Next i

End Sub

‘this is the sub

Private Sub NewButton(ByVal ButtonNumber As Integer)

    Dim oButton As Button
    oButton = New Button
    oButton.Enabled = True
    oButton.Location = New Point(ButtonNumber + 50, ButtonNumber + 50)
    oButton.Name = "MyButton" & ButtonNumber.ToString
    oButton.Size = New Size(75, 23)
    oButton.Text = "Button" & ButtonNumber.ToString
    oButton.Visible = True

    oButton.Tag = ButtonNumber

    TabControl.SelectedTab.Controls.Add(oButton)
End Sub

I would appreciate it if you guys could suggest what I need to change in order to achieve this functionality.

Thanks for your time

  • 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-06-13T14:29:49+00:00Added an answer on June 13, 2026 at 2:29 pm

    Maybe you button is Under the other controls, try calling oButton.BringToFront() after you add the button to the Tabcontrol controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have come across a large issue that i am having that has suddenly
I have never come across this issue but most recently I noticed that a
Sometimes I have come across this issue that whenever I change the order of
I've come across an issue that I feel has an extremely simple answer but
Has anyone come across this issue? Seems MS have broken it with their own
I have come across an issue with my application, I have an option class
I have recently started learning c# and have come across an issue. I'm not
hey there i wonder if any of you have come across a similar issue?
I'm just learning nHibernate and have come across what probably is a simple issue
I’m new to Selenium and I have come across a test case issue in

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.