You are on page 1of 5

Save MsFlexGrid Data

2015/05/25

www.developer.com
CodeGuru Home

VC++ / MFC / C++

.NET / C#

Visual Basic

VB Forums

User Name

Password

Log in

Developer.com

Help

Register

Remember Me?

Forum

What's New?

New Posts FAQ Calendar Forum Actions

Advanced Search

Quick Links

Forum Visual Basic Programming


Save MsFlexGrid Data

Visual Basic 6.0 Programming

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to
register before you can post: click the register link above to proceed. To start view ing
messages, select the forum that you w ant to visit from the selection below .

Click Here to Expand Forum to Full Width


Results 1 to 11 of 11

Thread: Save MsFlexGrid Data


Tweet

Share
Thread Tools

Display

1. Are you doing any of the following?


November 27th, 2001,

#1

03:09 AM

HPC

PIN
Member
Join Date:
Posts:

May 1999
71

Multi-core programming
Thread programming

Save MsFlexGrid Data

Parallelism
How can i save the data in the MSFlexGrid into the Access Database? Saying
that there are one unique code for multiple different product code in the
MsFlexGrid.

Parallel computing
None of the above

Hope you people can get what i means.


Thanks in advanced..

Reply With Quote

November 27th, 2001,

08:17 AM

#2

powered by

This is a CodeGuru survey question.

Iouri
Elite Member

Featured
Join Date:
May 2000
Location: New York, NY, USA
Posts:
2,878

Re: Save MsFlexGrid Data


1.Open recordset (rs)
2.Add ccells values to the recordset
with msfg
for iRows = 0 to .Rows-1
rs.Addnew
for iCols = 0 .Cols -1
rs!Fields(iCol) = .TextMatrix(iRow,iCol)
next iCols
rs.Update
next iRow

* The Perfect Platform for Game Developers:


Android
Developing rich, high performance Android games from
the ground up is a daunting task. Intel has provided
Android developers with a number of tools that can be
leveraged by Android game developers.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should
seriously consider bringing your Android mobile
development expertise to bear on the Windows 8
platform.
* Porting from Android to Windows 8: The Real
Story
Do you have an Android application? How hard would it
really be to port to Windows 8?

Iouri Boutchkine
iouri@hotsheet.com

Iouri Boutchkine
iouri@hotsheet.NOSPAM.com

Reply With Quote

November 27th, 2001,

08:50 PM

http://forums.codeguru.com/showthread.php?25568-Save-MsFlexGrid-Data

#3

1/5

Save MsFlexGrid Data

2015/05/25

PIN
Member
Join Date:
Posts:

May 1999
71

Re: Save MsFlexGrid Data


Thanks for ur quick response.
But i don't understand what is this means by; iRows and iCols here, can you
please explained it a bit? I'm just a Beginner for VB6. Any other website that i
can get references mroe about the MsFlexGrid and Database?
Perhaps can get your response soon. Thanks...

Reply With Quote

November 27th, 2001,

#4

09:49 PM

Fletch27278
Member
Join Date:
Location:
Posts:

Oct 2001
Hillsborough, NC
44

Re: Save MsFlexGrid Data


The MSFlexGrid is a Matrix and will have a certain number of rows and columns.
( example a 4 x 3 Matrix ) The code attempts to index or step through each
element in the matrix.
C++ Software Engineer
aka: Fletch
Hillsborough, NC

Reply With Quote

November 27th, 2001,

#5

10:17 PM

PIN
Member
Join Date:
Posts:

May 1999
71

Re: Save MsFlexGrid Data


Yes, i get it now, but when i execute the entire coding, the error occured at
this line:
myRS2!Fields(iCols) = .TextMatrix(iRows, iCols)
saying that the item cannot be found.
I believed the problem is at the iCols.
This is how my MsFlexGrid look like:
With msFlex
.Rows = 2
.Cols = 4
'Set the fixed Rows
.FixedRows = 1
.FixedCols = 0
.Rows = 1 ' Reset the No. of rows to 1 (which will be the Fixed Row now.)
So how can i solved this problem???

Reply With Quote

November 27th, 2001,

#6

10:38 PM

Fletch27278
Member
Join Date:
Location:
Posts:

Oct 2001
Hillsborough, NC
44

Re: Save MsFlexGrid Data


If the error is with the left hand side of the statement then I am not sure. My
first guess would be that the .TextMatrix is causing the error because it does
not have a object.
http://forums.codeguru.com/showthread.php?25568-Save-MsFlexGrid-Data

2/5

Save MsFlexGrid Data

2015/05/25

not have a object.


myRS2!Fields(iCols) = msFlex.TextMatrix(iRows, iCols)

If you have a 'With msFlex' before the .TextMatrix then the 'msFlex' object is
not required. Post the code along with the surrounding code that you are
having a problem with.
Is this what you have?
With msFlex
.Rows = 2
.Cols = 4
myRS2!Fields(iCols) = .TextMatrix(iRows, iCols)
.FixedRows = 1
.FixedCols = 0
.Rows = 1

C++ Software Engineer


aka: Fletch
Hillsborough, NC

Reply With Quote

November 27th, 2001,

#7

11:05 PM

PIN
Member
Join Date:
Posts:

May 1999
71

Re: Save MsFlexGrid Data


I think i should give you a clear view of how my program work.
1. i Set the MsFlexgrid in the Form_Load event: This is how it looks like:
With msFlex
.Rows = 2
.Cols = 4
'Set the fixed Rows
.FixedRows = 1
.FixedCols = 0
.Rows = 1
End With
2. I would like to save the data in the FlexGrid into the database. This is the
coding that i wrote:
With msFlex
For iRows = 1 To .Rows - 1
myRS2.AddNew
For iCols = 0 To .Cols - 1
myRS2.Fields("IdoNo") = txtIDONo.Text
myRS2!Fields(iCols) .TextMatrix(iRows, iCols)
Next iCols
myRS2.Update
Next iRows
IDoNo is NOT in the MsFlexGrid, it is the Fields in the parent forms.
So i think the problem is somewhere here...
Perhaps can get your guidliness here..
thanks a lot..

Reply With Quote

November 27th, 2001,

#8

11:21 PM

Fletch27278
Member
Join Date:
Location:
Posts:

http://forums.codeguru.com/showthread.php?25568-Save-MsFlexGrid-Data

Oct 2001
Hillsborough, NC
44

3/5

Save MsFlexGrid Data

2015/05/25

Re: Save MsFlexGrid Data


I assuming that the code under part 1 is working just fine. The code under part
2 does have a problem.
The line:
myRS2!Fields(iCols) .TextMatrix(iRows, iCols)
needs a '='
myRS2!Fields(iCols) = .TextMatrix(iRows, iCols)
Good luck, I gotta get some sleep. Scott

C++ Software Engineer


aka: Fletch
Hillsborough, NC

Reply With Quote

November 28th, 2001,

#9

12:03 AM

PIN
Member
Join Date:
Posts:

May 1999
71

Re: Save MsFlexGrid Data


Yes, actually that line got the '=', jst my mistake when paste it here.
Anyway, it is still not working well...
Have a nice sleep...

Reply With Quote

November 28th, 2001,

#10

12:44 AM

PIN
Member
Join Date:
Posts:

May 1999
71

Re: Save MsFlexGrid Data


I'm sorry about that, it is my mistake. I found out that the coding will working
well in this way:
myRS2.Fields(iCols) = .TextMatrix(iRows, iCols)
instead of
myRS2!Fields(iCols) = .TextMatrix(iRows, iCols)
Anyway, is it possible for me to select only certain field in the MsFlexGrid to
updated into the database? Example like:
myRS2.Fields("ProdCode") = .TextMatrix(iRows, iCols)
myRS2.Fields("Unit") = .TextMatrix(iRows, iCols)
Thanks a lot again for your previous help.

Reply With Quote

November 28th, 2001,

#11

06:26 AM

Iouri
Elite Member
Join Date:
May 2000
Location: New York, NY, USA
Posts:
2,878

Re: Save MsFlexGrid Data


iRows and iCols just variables (integer), which you have to dim
dim iRows as integer
dim iCols as integer
Iouri Boutchkine
http://forums.codeguru.com/showthread.php?25568-Save-MsFlexGrid-Data

4/5

Save MsFlexGrid Data

2015/05/25

iouri@hotsheet.com

Iouri Boutchkine
iouri@hotsheet.NOSPAM.com

Reply With Quote

Quick Navigation

Visual Basic 6.0 Programming

Top

Previous Thread | Next Thread


Posting Permissions

You may not post new


threads
You may not post
replies
You may not post
attachments
You may not edit your
posts

-- Blue Codeguru

BB code is On
Smilies are On
[IMG] code is On
[VIDEO] code is
On
HTML code is Off
Forum Rules

Contact Us CodeGuru Forums Privacy Statement Top


Acceptable Use Policy
Property of Quinstreet Enterprise.
Terms of Service | Licensing & Reprints | Privacy Policy | Advertise
Copyright 2015 QuinStreet Inc. All Rights Reserved.
All times are GMT -5. The time now is 05:49 PM.
Copyright Quinstreet Inc. 2002-2013

http://forums.codeguru.com/showthread.php?25568-Save-MsFlexGrid-Data

5/5

You might also like