Popup when clicked on a cell DataGridView possible?-VBForums
Results 1 to 11 of 11

Thread: Popup when clicked on a cell DataGridView possible?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    95

    Popup when clicked on a cell DataGridView possible?

    Hello! The title is misleading kinda haha. Anyways, I have a client that wants me to build them an application that uses DataGridView but wants a popup to happen whenever they click a cell. Like they are a store, they want to keep track of customer credit but whenever they click their name, they want to add a note of what they bought. Here is an image to help describe what I mean: Name:  Capture.PNG
Views: 128
Size:  2.6 KB Where it says Popup here or whatever, like a little overlay that they can add when press exit or an X or whatever? They want those notes to be linked to that specific cell and that is something I have no idea how to do, which is why I have come here. All help is awesome!

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,048

    Re: Popup when clicked on a cell DataGridView possible?

    Your explanation isn't really very clear but, as a general note, if you want to do something when the user clicks a cell in a DataGridView then you need to handle the CellClick event of that grid. The event handler provides to column and row indexes of the cell that was clicked so you can decide whether to do anything and what to do based on that. You can then display a tool tip or whatever.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    95

    Re: Popup when clicked on a cell DataGridView possible?

    Yes that what I want to do but here is what I don't know how to word: They input something, it will be different depending on who uses it. When they click that name(whatever it may be) a, say rich text box pops up. I want them to be able to write something and close it but it is saved to that specific cell, so to say.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,048

    Re: Popup when clicked on a cell DataGridView possible?

    As I said in my previous post, the CellClick event provides the column and row index of the cell that was clicked. I'm assuming that you know, or at least can find out, how to get a cell from the grid using those values.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    95

    Re: Popup when clicked on a cell DataGridView possible?

    Yeah I can. Just to make sure we are on both same page. I have my datagridview alphabetized so the position of the cell will be different from when they originally clicked and wrote. All that will be handled from what you mentioned, correct? Like they click on a name, write some stuff down, then click done. That data will be saved to that specific cell from what you mentioned, correct? Sorry as well, I am still learning and, well, this is how I learn.

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,048

    Re: Popup when clicked on a cell DataGridView possible?

    Quote Originally Posted by Dragnorian View Post
    That data will be saved to that specific cell from what you mentioned, correct?
    The data will go to the cell you send it to. If you use the column and row index provided by the CellClick event then it will go to the cell at that position. Will anything have happened between the click and where you want to send the data to the cell to have changed the positions of the cells? If not then what reason could there be for that to not be the cell that was clicked? It would take you about three minutes to test this for yourself. Just add the event handler, call InputBox and populate the cell. If that works then you know that the principle is sound and then you can change the input method to whatever you actually want.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    95

    Re: Popup when clicked on a cell DataGridView possible?

    I know how to use a cellclick event now but my issue I am trying to say isn't working. Nevermind about it, sorry for the troubles.

  8. #8
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,048

    Re: Popup when clicked on a cell DataGridView possible?

    Quote Originally Posted by Dragnorian View Post
    my issue I am trying to say isn't working.
    If it's not working then you did it wrong. If you don't show us what you did then we can't tell you what's wrong with it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    95

    Re: Popup when clicked on a cell DataGridView possible?

    The issue isn't coding. I am trying to understand this all. The whole thing is dynamic. That one specific cell I want to hold the data will move positions. I am trying to understand is this, even if the position of the cell moves, does that specific cell that originally stored the data when moved still hold that data?

  10. #10
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,048

    Re: Popup when clicked on a cell DataGridView possible?

    Quote Originally Posted by Dragnorian View Post
    The issue isn't coding. I am trying to understand this all. The whole thing is dynamic. That one specific cell I want to hold the data will move positions. I am trying to understand is this, even if the position of the cell moves, does that specific cell that originally stored the data when moved still hold that data?
    I don't really see how that's relevant. You're asking how to click a cell and populate that cell from a for that you display. What happens to the cell before that click and after it's populated isn't relevant at all. The cell is what it is and is where it is for that period so it matters not what happens outside that period. It seems to me that you're trying to complicate something that isn't complex. Have you done what I said and tested using InputBox? If not, why not? If so, did it work? If not, what happened? If so, it's working so there's no problem.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Nov 2016
    Posts
    95

    Re: Popup when clicked on a cell DataGridView possible?

    Alright I got it, thanks man!

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.