Results 1 to 24 of 24

Thread: Vb6.0 And Probs With Vsflexgrid

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Vb6.0 And Probs With Vsflexgrid

    Hello All

    i got stuck at this point

    i have two flexgrids

    one is main flex grid and second is say"child"flex grid main flex grid working smoothly


    in first flex
    if when i click on particular row it shows tht customers details in above textboxes
    following by customer number

    child flex is for saving family details of that particular customer

    identified by customer number

    for example

    title,firstname,middle name,last name,birthdate and im field is relation with that customer

    here i put a button called"next"

    whn iclick on next text box values goes to flex
    using.textmatrix concept
    and when i click on "Save"

    here problem comes

    i have used for loop..
    ========

    1st problem is

    in database blanks getting saved
    i cant give primary key
    as family records r unlimited

    records are not showing for a particulat customer number....

    pls tell me

    which loop to use n hw.??

    using array,temptable that i used

    bt i want in this way

    pls help me
    Thanks in advance
    Ash

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Vb6.0 And Probs With Vsflexgrid

    Thread moved from CodeBank forum (which is for code examples, not questions)

  3. #3
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    Welcome to the Forum!

    could you post your code for saving?
    IIF(Post.Rate > 0 , , )

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb6.0 And Probs With Vsflexgrid

    Quote Originally Posted by ash007
    records are not showing for a particulat customer number....
    Just one particular customer, or not showing for all customers?

    As zeezee said, show us your code.

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    that problem i solved it was regarding customer code
    i put combobox and atext box for customer category
    and in frame a text box for customer code

    on lost foucus of customercategory code gets generated
    so we can change category,...


    as i am saving .textmatrix to rs.fields
    r for row
    .textmatrix(r,1)=rs.title
    .textmatrix(r,2)

    {actually code is not on this machine.. bt will definitely try to get on this forum

    so sorry forthis inconvi.}

    bt will keep soon


    bt main problem still there
    Last edited by ash007; Sep 25th, 2007 at 09:54 AM.

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    abt flex

    when i click on "Next"command
    it shud go to that flex
    ok??
    1.now for cust1 if record is already there then current record shud get added to next row

    it means i need to check textmatrix is empty or not
    bt i dont knw how?

    note for u :
    textmatrix will have record
    if it is in the recordset for that particular customer id

    2.a flow i m expecting is
    when i click on a row of parent flex a records we can see by customer id
    ok?

    so if i clicked on "edit" family -child flex is editable
    so i add title,firstname,lastname,bdate,relation
    n click on next command
    a)it will get added to flex on row 1
    as row 0 is reserved for column title
    b)so according to that textmatrix it will goto database

    c)when i try to add some records for
    eg.cust 2
    if records are already there in database for cust2
    for eg 2 records
    so current record we r trying to add it shud get added to 3d row

    not on 1st or 2d row...

    i think a simple loop is to use
    bt tried for loop i think it will work bt how????
    how????how????how????how????how????how????how????
    pls help me

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Vb6.0 And Probs With Vsflexgrid

    The VSFlexGrid is not a standard grid control. Does it have a TextMatrix property? (I've never used this control before.)

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    yes..
    it is having properties..
    can u tell me wht loop is to use to check textmatrix is empty
    u conside msflexgrid
    if textmatrix is empty then add current data to 1st row
    if it has some data then..for eg 2 rows
    for a particular cust id

    then add current data to 3d row...

  9. #9
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    well , the way I m checking is if the Flex has one Fixed Row
    Code:
    If MSFlex.Textmatrix(1,1) = vbNullString Then
      ' no Data in the Flex.
    Else
       ' Has Data in the Flex.
    Endif
    I also Assume that if the Flex is updated the column 1 would be filled.

    To increase the number of Rows, you can use

    MSFlex.Rows = MSFlex.Rows + 1

    But I still didnt see your full code. Can you post that?
    IIF(Post.Rate > 0 , , )

  10. #10

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    yes will do when i will sit on that pc!

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    ok it is for checking textmatrix empty or not
    Last edited by ash007; Sep 25th, 2007 at 12:35 PM.

  12. #12

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    ok it is for checking textmatrix empty or not

    bt wht will be the case if for a cust id we have 2 records already?????

    if isnull(flx.texmatrix(r,c)) then
    add to flex
    else
    hw to define if a textmatrix has 2 records????
    how to write?
    pls reply
    Last edited by ash007; Sep 25th, 2007 at 12:34 PM.

  13. #13
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    well that I already posted. use the Rows property.

    Code:
    If MSFlex.Textmatrix(1,1) = vbNullString Then
      ' no Data in the Flex.
    Else
       ' Has Data in the Flex.
       MSFlex.Rows = MSFlex.Rows + 1
       MSFlex.Textmatrix(MSFlex.Rows - 1,1) = 'Something'
       ' rest of your code
    EndIf
    I cant say whether this would work for you 100%, but get the general Idea
    IIF(Post.Rate > 0 , , )

  14. #14

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    k will work on it 2marow n will giv u feedback with main code

  15. #15

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    here is code
    saving records frm textmatrix to db

    Code:
      For i = 1 To LvwFamilyDetails.Rows - 1
              '''''''For i = 1 To rsfamily.RecordCount
                TotalRows = LvwFamilyDetails.TextMatrix(i, 0)
                   If TotalRows = 0 And old_CustNo = 0 Then     
                        With LvwFamilyDetails
    
    
    	strUpdate = "Update MS_FamilySET "
                                 strUpdate = strUpdate & "FFTitle='" & IIf(Not IsNull(Trim(.TextMatrix(i, 6))) Or 	Trim(.TextMatrix(i, 6)) <> "", Trim(.TextMatrix(i, 6)), "") & "',"
    	so on.....
    	where strUpdate = strUpdate & " where CustomerNo= '" & Trim(txtCustomerNo.Text) & "'"
    
    	else '''''''''for editing
     
    	strUpdate = "Delete From MS_Family where  CustomerNo='" & old_CustNo & "'"
    	
                        sdb.Execute (strUpdate)
    
    
    	then insert statements
    		
    
    next
    it will work properly if cmdnext will work properly
    so pls help me on cmd next
    Code:
    Private Sub CmdNextFamily_Click()
     rowcount=flx.rows
     If FlgEditFamily = True Then
        flx.TextMatrix(rowcount, 7) = txtFTitle.Text
        flx.TextMatrix(rowcount, 8) = txtFirst.Text
        flx.TextMatrix(rowcount, 9) = txtMiddle.Text
        flx.TextMatrix(rowcount, 10) = txtLast.Text
        flx.TextMatrix(rowcount, 3) = txtFrelation.Text
        flx.TextMatrix(rowcount, 4) = txtFMobile.Text
        flx.TextMatrix(rowcount, 5) = txtFEmail.Text
        flx.TextMatrix(rowcount, 6) = txtFBirthdate.Text
     else
        With flx
    '       
            .Rows = 1
            .RowHeight(0) = 300
            .Cols = 12
             Dim icnt As Integer
             For icnt = 0 To 11
               .ColAlignment(icnt) = flexAlignLeftCenter
             Next icnt
                     .ColWidth(0) = 500
                     .ColWidth(1) = 1800
                     .ColWidth(2) = 2000
                     .ColWidth(3) = 700
                     .ColWidth(4) = 1500
                     .ColWidth(5) = 1500
                     .ColWidth(6) = 2000
                     .ColWidth(7) = 0
                     .ColWidth(8) = 0
                     .ColWidth(9) = 0
                     .ColWidth(10) = 0
                     .ColWidth(11) = 0
    
    
                    .TextMatrix(0, 0) = "No."
               '    .TextMatrix(0, 1) = "Person Number"
                    .TextMatrix(0, 1) = "Customer Number"
                    .TextMatrix(0, 2) = "Name"
                    .TextMatrix(0, 3) = "Relation"
                    .TextMatrix(0, 4) = "Mobile No."
                    .TextMatrix(0, 5) = "Email"
                    .TextMatrix(0, 6) = "Birth Date"
                    .TextMatrix(0, 7) = "Sal"
                    .TextMatrix(0, 8) = "FName"
                    .TextMatrix(0, 9) = "MName"
                    .TextMatrix(0, 10) = "LName"
                     
                    'For i = 1 To flx.row-1
                    
                    .Rows = i + 1
                    .AddItem Str(i + 1)
                    .TextMatrix(i + 1, 1) = i + 1  '    .TextMatrix(i + 1, 1) = (txtCount.Text)
                    .TextMatrix(i + 1, 2) = (txtFTitle.Text) & " " & (txtFirst.Text) & " " & (txtMiddle.Text) & " " & (txtLast.Text)
                    .TextMatrix(i + 1, 3) = (txtFrelation.Text)
                    .TextMatrix(i + 1, 4) = (txtFMobile.Text)
                    .TextMatrix(i + 1, 5) = (txtFEmail.Text)
                    .TextMatrix(i + 1, 6) = (txtFBirthdate.Text)
                    .TextMatrix(i + 1, 7) = (txtFTitle.Text)
                    .TextMatrix(i + 1, 8) = (txtFirst.Text)
                    .TextMatrix(i + 1, 9) = (txtMiddle.Text)
                    .TextMatrix(i + 1, 10) = (txtLast.Text)
             '   Next
                    i = i + 1
        End With  
     
             Call ClearFControls   
       End If
    End Sub
    AGAIN

    I WILL write

    i want to add new record on click of next cmd
    if for a cust id textmatrix is empty then add to 1st row
    else add to next row

    then only save part delete old cust id will work.....

    pls help in that
    Last edited by si_the_geek; Sep 26th, 2007 at 07:25 AM. Reason: added code tags

  16. #16
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    ok I m not getting this clearly.
    But guesssing from your code the place you should change is this

    .Rows = i + 1

    it cloud be replaced by following

    Code:
    If flx.Textmatrix(1,1) = vbNullString Then
      ' no Data in the Flex.
    Else
       ' Has Data in the Flex.
       flx.Rows = flx.Rows + 1
    EndIf

    And your

    .TextMatrix(i + 1, 1) = i + 1 ... could be changed to

    .TextMatrix(flx.Rows-1, 1) = flx.Rows

    But Still I m not getting your problem correctly.
    IIF(Post.Rate > 0 , , )

  17. #17

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    Hello sir
    just tell me abt next button for nw

    normally we send record to database on click of button
    from "textbox" to recordset

    here im doing textbox to textmatrix
    and textmatrix to db..for that i need to fill flex correctly

    Again i am trying to describe prob.

    as we go on vacation we go along with family

    there may b 2..3.... 5.. members of a customer for a picnic
    we need to keep record for tht
    or if a business tour managers go along with assitant or secretary
    1..2...3. unlimited max wud b 10 bt im not putting limit


    so next commond and flex is working for this purpose

    if edit mode of the form then.........

    If FlgEditFamily = True Then
    flx.TextMatrix(rowcount, 7) = txtFTitle.Text
    flx.TextMatrix(rowcount, 8) = txtFirst.Text
    ========================
    rowcount is row of tht flex

    that i have declared on click of flx.
    for on click of a row tht row record will get in to that flex
    txtFTitle.Text= flx.TextMatrix(rowcount, 7)
    ================== textmatrix or say flex to text =======
    if flgeditfamily true then
    on click will go in text box n and after editing it will go in textmatrix

    Bt u knw its not working properly properly cos i also not getting whr the error is???
    ===============================
    if adding a new record for a cust id
    then it shud go to 1st row
    am i right?

    if for a customer already having 2 familymembers n wnt to add 3 d members details..then

    it shud go on 3rd row...
    ====================================
    in my mind...the ways exisiting are above
    else

    i need to keep row zero intially
    bt practically it gives me error on rowheight

    then
    to check flexrows or say flex empty or not for a customerid

    then same if ..no record on 1strow else noofrows+1
    bt how????????????????????????????

    my errors:
    its incosistant for the "for loop"

    1st record added to 1st row
    2d record on 3drow
    3 on 5throw..
    so on...

    pls tell me if u have any solution on this

  18. #18
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    OK . clarify If I m wrong.

    You first load the Existing Family details to the text boxes. If there aren't any existing details, you enter new Family details for that customer?

    When you click the Next Family button, you want to save these info to the Flex correctly.
    If it's edited data , then update the correct row in the flex.
    Or If its a new Family Data , insert it to the next row of the flex ?

    Is that your goal?
    IIF(Post.Rate > 0 , , )

  19. #19

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    hello sir...
    i am weak in explaination i think so
    here again puttinng the things
    1)load family flex with details

    2)after selecting a cust id

    i must see tht cust id's record

    3) if no record
    then i put values in textbox 1st record added to flex on click of next
    record2 again click next and go on...

    4) on main form there is save buttoon save add edit delete

    5)there only it goes to db
    6)flex is forr saving multiple records or say for data entry...
    thank in advance
    ash
    Last edited by ash007; Sep 27th, 2007 at 08:13 AM.

  20. #20
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    Well I m confused again

    Well, here what I understood

    You need to put he values in the text boxes to the flex.
    It should go to the Next Row of the flex when you click the cmdNext ?

    And the situation for inserting to flex has two options. This is checked by the fldEditFamily
    If flgEditFamily is true - it means the values for Family details are edited. So need to UPDATE the values in the Flex with current values in the text boxes.

    If flgEditFamily is false - it means a new record. So you have add this to the bottom of the flex with a new row.

    Is this the flow of your cmdNext Click (This I guessed from you code given here.)

    And If you could put your project so I can understand it properly.

    IIF(Post.Rate > 0 , , )

  21. #21

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    Hello sir..
    k..
    already posted...that above
    will post again..
    till now..tht frm my post..
    can u suggest me the way for this prob?
    apart from that above u suggested?

  22. #22
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    is your variable i is defined as global or static?
    try this

    change this line

    .Rows = i + 1

    to
    Code:
    .Rows = .Rows + 1
    i = .Rows - 1
    in your CmdNextFamily click.
    IIF(Post.Rate > 0 , , )

  23. #23
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Vb6.0 And Probs With Vsflexgrid

    ok try this code

    vb Code:
    1. Private Sub CmdNextFamily_Click()
    2.  RowCount = flx.Rows
    3.  If FlgEditFamily = True Then
    4.     flx.TextMatrix(RowCount, 7) = txtFTitle.Text
    5.     flx.TextMatrix(RowCount, 8) = txtFirst.Text
    6.     flx.TextMatrix(RowCount, 9) = txtMiddle.Text
    7.     flx.TextMatrix(RowCount, 10) = txtLast.Text
    8.     flx.TextMatrix(RowCount, 3) = txtFrelation.Text
    9.     flx.TextMatrix(RowCount, 4) = txtFMobile.Text
    10.     flx.TextMatrix(RowCount, 5) = txtFEmail.Text
    11.     flx.TextMatrix(RowCount, 6) = txtFBirthdate.Text
    12.  Else
    13.     With flx
    14. '
    15.         If .TextMatrix(1, 1) = "" Then
    16.            
    17.             .RowHeight(0) = 300
    18.             .Cols = 12
    19.              Dim icnt As Integer
    20.              For icnt = 0 To 11
    21.                .ColAlignment(icnt) = flexAlignLeftCenter
    22.              Next icnt
    23.                  .ColWidth(0) = 500
    24.                  .ColWidth(1) = 1800
    25.                  .ColWidth(2) = 2000
    26.                  .ColWidth(3) = 700
    27.                  .ColWidth(4) = 1500
    28.                  .ColWidth(5) = 1500
    29.                  .ColWidth(6) = 2000
    30.                  .ColWidth(7) = 0
    31.                  .ColWidth(8) = 0
    32.                  .ColWidth(9) = 0
    33.                  .ColWidth(10) = 0
    34.                  .ColWidth(11) = 0
    35.  
    36.  
    37.                 .TextMatrix(0, 0) = "No."
    38.            '    .TextMatrix(0, 1) = "Person Number"
    39.                 .TextMatrix(0, 1) = "Customer Number"
    40.                 .TextMatrix(0, 2) = "Name"
    41.                 .TextMatrix(0, 3) = "Relation"
    42.                 .TextMatrix(0, 4) = "Mobile No."
    43.                 .TextMatrix(0, 5) = "Email"
    44.                 .TextMatrix(0, 6) = "Birth Date"
    45.                 .TextMatrix(0, 7) = "Sal"
    46.                 .TextMatrix(0, 8) = "FName"
    47.                 .TextMatrix(0, 9) = "MName"
    48.                 .TextMatrix(0, 10) = "LName"
    49.         End If
    50.           .AddItem Str(i + 1) & vbTab & (txtFTitle.Text) & " " & (txtFirst.Text) & " " & (txtMiddle.Text) & " " & (txtLast.Text) & vbTab & _
    51.                 (txtFrelation.Text) & vbTab & (txtFMobile.Text) & vbTab & (txtFEmail.Text) & vbTab & (txtFBirthdate.Text) & vbTab & _
    52.                 (txtFTitle.Text) & vbTab & (txtFirst.Text) & vbTab & (txtMiddle.Text) & vbTab & (txtLast.Text)
    53.                
    54.                 i = i + 1
    55.     End With
    56.  
    57.          Call ClearFControls
    58.    End If
    59. End Sub
    IIF(Post.Rate > 0 , , )

  24. #24

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    35

    Re: Vb6.0 And Probs With Vsflexgrid

    thanks a lot sir..
    i will try this..

    actually i cudnt able to put my project here as u were asking me to do..
    i tried to do tht frm office bt net was too slow to upload the things

    n at home pc i dont have vb to test the code.. only i can visualize...

    k.. will do that n will inform u as things happen!

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