Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Grid Control - which will be easier ?

Posted on 2004-09-16
11
Medium Priority
?
269 Views
Last Modified: 2010-05-02
Hi
Which data grid or flex grid can i use for the following
i need to show a grid with 10 cells and 3 rows.

my user wants to be able to enter say 10 in cell0 and 100 in cell9
i need to then apply a basic formula that will then automatically
populat the rest fo the cells.

Basically i need to be able to program or code around the cells, the user is
uing excel at the moment,

i then need to tkae the values he has entered and then proces sthem into a specific
table in an access dataabse. My user also wants to be able to copy and paste say 10 cells
from excel into my gird on the form

does anyone have some suggestions and samlpe code please

thanks

0
Comment
Question by:CraigLazar
  • 6
  • 5
11 Comments
 
LVL 15

Expert Comment

by:unknown_routine
ID: 12074415
Hi,

Go for flexgrid, it has more functionality.

To be able to edit the cells use this:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q201/1/97.asp&NoWebContent=1


<<my user wants to be able to enter say 10 in cell0 and 100 in cell9
i need to then apply a basic formula that will then automatically
populat the rest fo the cells.>>>

This is easy: you the textmatrix property and write a basic function to do this.
<<i then need to tkae the values he has entered and then proces sthem into a specific
table in an access dataabse. >>

Again this is basic Database operation. you use a recordset and set its values to the cell values and update the database.



<<My user also wants to be able to copy and paste say 10 cells
from excel into my gird on the form>>

This is probably the  hardest part of the question.

Use clipboard object to read the values.

Example:

if in Excel we have

1     2                (in some cells)
3     4  
and user copy them to memory.


in vb use this:

Dim v
v = Clipboard.GetText

now v contains  1##2##3##4

use this date and paste it to proper fields in Flexgrid.



buttom line: Your question is like a whole project and you need to work and research to do it.

But all steps are bacially easy and you will learn a lot applying those.


Regards.















0
 
LVL 4

Author Comment

by:CraigLazar
ID: 12074615
hey cool by the pool, thanks a stack\
i am craming this tonight and tomorrow, so i will let u know
thanks again



cheers

Craig
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 12074882
for editing part You need only a textbox

Use this very informational example:

http://www.vb-helper.com/howto_edit_flexgrid_control.html

(forget about previuos link which is supplies by microsoft which happens to be very unstable)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:CraigLazar
ID: 12131994
Hi
Sorry for getting back to u on this, I have been really busy on the backend and the database
how do i set the flex grid up so i can simply select a cell and type a value in that cell ?

thanks a stack

Cheers
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 12132444
flex grid itself does not allow you to do this. the trick is to use a textboxand move it to the editing cell.(this
is standard method for doing this)

and again this is very simple , look here for step by step how to do this:


http://www.vb-helper.com/howto_edit_flexgrid_control.html 
 
 


0
 
LVL 4

Author Comment

by:CraigLazar
ID: 12133520
Hi
thanks got it going,
say if i have 3 columns, how can i say set the second rows backcolor to blue
so the whole row is bluem i can get just the cell to go blue if i click on it, cause i need to check a variable before loading data into the grid so if row 2 is yes, then its backcolor must be different to row 1 and 3 if that makes any sense ?

thanks again for the help
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 12133602
I'm not sure what you mean here,

But to change a cell background  do this:( f is name of flexgird)

(change background of cell 2,7 ,flexgrid is zero based)
f.Col = 1
f.Row = 6
f.CellBackColor = vbBlue
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 12133779
u a champ -
Can i grade this question, cause i might need some more help on this as i go along, so can i ask more questions and then add to the points ?

thanks a stack
let me know

cheers
have a great weekend
0
 
LVL 15

Accepted Solution

by:
unknown_routine earned 500 total points
ID: 12133896
I really don't mind answer your questions and I'm not into points (specaily in VB forum).

However forum guideline asks 1 question per thread.

I will be happy to help anyway.
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 12134073
cool thanks - just do not want to take advantage,


have a good one

cheers
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 12158087
morning unkown_routine

Quick question, how easy is it for me to now read teh values out of the cells cause
i then need to update my table in my db with the values in the grid ?

thanks a stack

Cheers
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question