Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Timetable idea

Status
Not open for further replies.

Gaff

Programmer
Dec 13, 2001
30
IE
Hi,
What i wanted to do i thought was very simple but apparently not. Basically i want to be able to put a table template on a vb form and populate it myself. I DON'T WANT TO PUT A TABLE FROM A DATABASE on the form in VB just a table structure like you would see in a book. Any of the grids in vb seem to be deriving their info from a database but i don't want this as i want to be able to manipulate the contents. Like if you created a table in word and then populating it but i don't want to use VBA or Word. So if anyone has any ideas or suggestions i'd appreciate it. It is a timetable project i'm doing so i just want a standard template and it will be populated then based on the users selection.
Thanks.
 
What you want to do is very common and easy. The grid needs to be an unbound grid. Usually the MSFlexGrid control is a good option. You can manipulate the rows and cells, as well as the height, and add content at will. Almost any grid should have an unbound method. What type of grid are you using? See if it has a bound or unbound property or method.
 
Thanks for that. The FlexGrid sounds fine, but where do i find the bound property, it doesn't seem to be in the property window. Also when i want to manipulate the table to put in column headings do i refer to the cells i want to work with as if the grid is a two dimensional array, for example if i wanted to name the first grid "time" would i refer to it as (0,0) and the set the text property equal to time?? Sorry if these questions are very basic but i never realised you could manipulte a flexgrid like that. I would appreciate any help you can give, thanks.
 
By default it should be unbound. You actually have to specify alot of database information for it to be bound. So if you did not do that, then it is already unbound.

The very first row is always zero and the very first column is always zero. So if you have fixed rows then yes, they are indexed as zero.


You cannot name the grid "time" because it is a reserved word in VB. Let's say you have a grid called grdTime and you want the fixed columns to have letters going across. sort of like Microsoft Excel. They have letters across their fixed columns and numbers down their fixed rows. Here' code to do that:

Dim X as integer
grdTime.Cols=30
grdtime.Rows=30

For X = asc("A") to asc("Z")
grdTime.TextMatrix(0, X-(asc("A")+1)=chr(X)
Next

The TextMatrix property allows you to specify which row and column you want to put data in or get data from. Do NOT refer to the grid as a two dimensional but simply by it's name. The two dimensional array comes in with a property of the grid as seen above with the TextMatrix property.

Hope that helps. You can always look at the help file on MsFlexGrid. No question is too basic to ask!
 
Thanks for your help, i can get the flexgrid to do what i want now. Once again thanks
 
Just one more thing, is it possible to put more than one value in a cell so that one is above the other, I tried usign the 'vbcrlf' but this didn't seem to work.When i say i used the vbcrlf i mean i used it in a variable that i was using to multiple values to the variable.
it just concatenated the two strings with ||.The same occured when i tried this with a text box. can you only concatenate the strings, is it not possible to display one above the other like: this
and this


Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top