CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    2

    Question Please help with datagridview

    Hi,

    I'm totally beginer (noob) in programmers world, I'm trying to prepare my first program (database). I'm creating it just acording to my knownledge so it's a little bit cr..

    in form1 I've 3 comboboxes (CB) 3datagridviews(DGV) and some textboxes (TB)

    all DGV are connected to a diffrent database files..
    CB1 list values from DGV1; CB2 from DGV2 etc

    'CB1.DisplayMember = "Column3"
    CB1.DataSource = dBaseDT

    when I'm choosing the value from CB1 then values in CB2 and CB3 are changing to the same value. then in all DGV is sellected row with value choosen in CB1 (if present).
    '
    CB2.Text = CB1.Text



    Now I would like to copy the text from specific colum of choosen row in DGV1 to TB1... but only part of the text..
    I'm using this

    'Dim mm As String
    'TB1.DataBindings.Clear()
    'TextBox1.DataBindings.Add("TEXT", dBaseDT, "Column10")
    'mm = TB1.Text
    'TB1.DataBindings.Clear()
    'TB1.Text = Microsoft.VisualBasic.Right(mm, 3)

    unfortunately when I make simple databinding without cutting the text it shows me value from actual sellected row but wen I'm using Microsoft.VisualBasic.Right it shows me the cutted part from previous choose.

    Please teach me how to fix it??

    Thanks
    Mic
    Last edited by Mic13; May 22nd, 2012 at 02:24 PM. Reason: accidentialy created 2 post for the same thema

  2. #2
    Join Date
    May 2012
    Posts
    2

    Question problem with datagridview

    To solve this problem I used something not properly Inteligent.
    I just add additional form and additional operation for user. First on the main form user needs to click the button that will show additional form.
    To make this form more useful I prepared this form as something print preview scrollable form (of corse due to scrollable form to print this I need to use not printform but printdocument with functions to draw same as additional form view)
    On additional form I used the same function like I tried to use in original main form

    Code:
    mm = TB1.Text
    TB1.Text = Microsoft.VisualBasic.Right(mm, 3)
    and now it works - it shows the proper (cutted) value so I can export it to other database. maybe something was updated during opening new form.


    thread colsed
    Last edited by Mic13; May 22nd, 2012 at 02:36 PM. Reason: solved

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Please help with datagridview

    Thanks for sharing your solution.

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

Featured