|
-
Sep 22nd, 2007, 05:42 AM
#1
Thread Starter
Member
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
-
Sep 22nd, 2007, 12:53 PM
#2
Re: Vb6.0 And Probs With Vsflexgrid
Thread moved from CodeBank forum (which is for code examples, not questions)
-
Sep 23rd, 2007, 08:52 AM
#3
Frenzied Member
Re: Vb6.0 And Probs With Vsflexgrid
Welcome to the Forum!
could you post your code for saving?
-
Sep 24th, 2007, 06:28 AM
#4
Re: Vb6.0 And Probs With Vsflexgrid
 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.
-
Sep 25th, 2007, 09:35 AM
#5
Thread Starter
Member
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.
-
Sep 25th, 2007, 09:55 AM
#6
Thread Starter
Member
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
-
Sep 25th, 2007, 10:13 AM
#7
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.)
-
Sep 25th, 2007, 10:46 AM
#8
Thread Starter
Member
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...
-
Sep 25th, 2007, 11:58 AM
#9
Frenzied Member
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?
-
Sep 25th, 2007, 12:28 PM
#10
Thread Starter
Member
Re: Vb6.0 And Probs With Vsflexgrid
yes will do when i will sit on that pc!
-
Sep 25th, 2007, 12:31 PM
#11
Thread Starter
Member
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.
-
Sep 25th, 2007, 12:31 PM
#12
Thread Starter
Member
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.
-
Sep 25th, 2007, 12:35 PM
#13
Frenzied Member
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
-
Sep 25th, 2007, 01:47 PM
#14
Thread Starter
Member
Re: Vb6.0 And Probs With Vsflexgrid
k will work on it 2marow n will giv u feedback with main code
-
Sep 26th, 2007, 01:57 AM
#15
Thread Starter
Member
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
-
Sep 26th, 2007, 11:04 AM
#16
Frenzied Member
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.
-
Sep 27th, 2007, 07:18 AM
#17
Thread Starter
Member
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
-
Sep 27th, 2007, 07:44 AM
#18
Frenzied Member
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?
-
Sep 27th, 2007, 08:09 AM
#19
Thread Starter
Member
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.
-
Sep 27th, 2007, 08:41 AM
#20
-
Sep 28th, 2007, 12:39 PM
#21
Thread Starter
Member
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?
-
Sep 28th, 2007, 12:54 PM
#22
Frenzied Member
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.
-
Sep 28th, 2007, 01:04 PM
#23
Frenzied Member
Re: Vb6.0 And Probs With Vsflexgrid
ok try this code
vb 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
'
If .TextMatrix(1, 1) = "" Then
.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"
End If
.AddItem Str(i + 1) & vbTab & (txtFTitle.Text) & " " & (txtFirst.Text) & " " & (txtMiddle.Text) & " " & (txtLast.Text) & vbTab & _
(txtFrelation.Text) & vbTab & (txtFMobile.Text) & vbTab & (txtFEmail.Text) & vbTab & (txtFBirthdate.Text) & vbTab & _
(txtFTitle.Text) & vbTab & (txtFirst.Text) & vbTab & (txtMiddle.Text) & vbTab & (txtLast.Text)
i = i + 1
End With
Call ClearFControls
End If
End Sub
-
Sep 29th, 2007, 12:59 PM
#24
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|