Results 1 to 4 of 4

Thread: [RESOLVED] two fields in one datagrid column...

  1. #1

    Thread Starter
    Registered User
    Join Date
    Nov 2005
    Posts
    206

    Resolved [RESOLVED] two fields in one datagrid column...

    ok, so on form_load, i programatically added columns to the datagrid like so...

    VB Code:
    1. column = New DataGridTextBoxColumn
    2.         column.MappingName = "contact_given"
    3.         column.HeaderText = "Name"
    4.         column.Width = 150
    5.         tsContacts.GridColumnStyles.Add(column)
    6.  
    7.         column = New DataGridTextBoxColumn
    8.         column.MappingName = "contact_surname"
    9.         column.HeaderText = "Name"
    10.         column.Width = 150
    11.         tsContacts.GridColumnStyles.Add(column)

    my question is that, can i add to colums from my database(contact_given & contact_surname), to only one colum in my datagrid(Name)

    Thanks, Justin

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

    Re: two fields in one datagrid column...

    No. You'd need to create another column in your data source and use its Expression property to create the combined values. Either that or use your query to create the combined column when you retrieve the data in the first place.
    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
    Registered User
    Join Date
    Nov 2005
    Posts
    206

    Re: [RESOLVED] two fields in one datagrid column...

    Thank you for clearing that up for me

  4. #4
    New Member
    Join Date
    Jan 2008
    Posts
    1

    Re: two fields in one datagrid column...

    Hi! I'm struggling with this one, could you show me some code? because you lost me with the Expression Property part. I'm working for the mobile platform.
    Thanks

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