Menu

How to get the value from a selected cell

Help
2006-10-25
2013-04-23
  • Nobody/Anonymous

    Hi, i got a 4X4 grid and a textbox, how do you show the value of a selected cell in the textbox when the cell is clicked? Thanks

     
    • Davide Icardi

      Davide Icardi - 2006-10-25

      Hi,
      Sorry but I'm not sure to have understand correctly.

      When a cell is clicked (normally receive the focus) is created a focus rectangle.
      You can retrive the selected cell using grid.Selection.ActivePosition property

      Davide

       
    • Nobody/Anonymous

      In sample 26 of "Grid Samples", a messagebox showing a value will pop up when a cell in column 1 is clicked. How can i show the value in a textbox instead of a message box? Can you provide some sample code for this?
      Thx

       
      • Davide Icardi

        Davide Icardi - 2006-10-27

        Hi,

        You can replace this line:
        MessageBox.Show(sender.Grid, sender.GetDisplayText());

        with

        yourTextBox.Text = sender.GetDisplayText();

        Davide

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.