Results 1 to 7 of 7

Thread: types

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Posts
    308

    types

    I was wondering how to set a value for datagridcell. It is saying it is a type and cant be used as an expression

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: types

    Quote Originally Posted by tarik666
    It is saying it is a type and cant be used as an expression
    What is?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Posts
    308

    Re: types

    Ok i just want to change the value of the data grid cell so i tried
    datagridcell =5 but tht doesnt work

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: types

    What is your DataGrid bound to? Is it a DataTable? If so then you need to set the value in that table. A DataGridCell doesn't expose any value; only its coordinates. Let's say that you want to programmatically set the value of the current cell to a value from a TextBox:
    vb.net Code:
    1. Dim cell As DataGridCell = myDataGrid.CurrentCell
    2.  
    3. myDataTable.DefaultView(cell.RowNumber)(cell.ColumnNumber) = myTextBox.Text
    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
    Hyperactive Member
    Join Date
    Dec 2007
    Posts
    308

    Re: types

    Im using vb 2008 and that didnt work is there a way of changing it so it does work

  6. #6
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: types

    I'm just saying this for your beneficial:

    If you're going to reply with a sentence for each of your posts, don't expect a resolution soon. You need to tell us what you did, where you put the code, why you put it there, what you expected to happen and what actually did, your code you are using, possibly some pseudo code, the error you are receiving, and more! I mean, seriously, just write a book. Spill out all the details, whether you think it is relevant or not.

    This way, we can further help you. You can't be lazy with your posts and just expect someone to just give you the answer, especially when they can't tell what the problem is by the wording of your posts.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: types

    It shouldn't take until post #5 for you to tell us which version you're using. Radio buttons are provided for the purpose when you create a thread. Please use them in future.

    If you're using VB 2008 then I think it unlikely that you're using a DataGrid, unless you've upgraded a VB.NET 2002/2003 project. More likely you're using a DataGridView, in which case any advice regarding a DataGrid is likley to be irrelevant. Can you please tell us EXACTLY what type of grid you're using. It is important to be precise because it's easy to cause confusion otherwise and end up wasting everyone's time, your own included.
    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

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