How to create a Grid?

This is the requirement of my project:
    The users will be able to enter as many number of rows and once the user finishes, then I want to read all the rows in the Grid and do a lot of manipulations and then enter into the database. I have searched MSDN but I am always finding grids associated to Databases. Is there any way to fulfil my requireent?
I have worked a lot with Java and I wanted almost a Java like output (functionally) enabling user to enter as many number of rows he wanted!! (ofcourse, it's not a big problem if there is a limit like 10 rows!!)
if someone can send an example project to my mail account, then I will be happy to award 100 points for him/her!!
Thanks and Regards,
Badri
LVL 8
gvsbnarayanaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jbilConnect With a Mentor Commented:
Not sure if this is what you want. This sub will grid any object with a left and top property. ie textbox, label, etc.
set object index to 0 then call like this.

grid label1 10,10


Private Sub grid(theobject As Object, nocols, norows)
Dim i
Dim orignalpos
orignalpos = theobject(0).Left
For i = 1 To (nocols * norows) - 1
    Load theobject(i)
    theobject(i).Visible = True
    'theobject(i).Caption = Chr(i)  'set object properties
        If i Mod nocols = 0 Then
            theobject(i).Top = theobject(i - 1).Top + theobject(i -

1).Height
            theobject(i).Left = orignalpos
        Else
    theobject(i).Top = theobject(i - 1).Top '+ theobject(i).Height
    theobject(i).Left = theobject(i - 1).Left + theobject(i).Width
    End If
Next

End Sub
0
 
gvsbnarayanaAuthor Commented:
Dear  jbil ,
     I am new to VB so can you please be more clear!! I mean which Grid you are using in this code snippet you have given me? Is it DBGrid or MSHFlexGrid or what?
Which Grid control will be best for this type of Applications?
Thanks and Regards,
Badri
0
 
jbilCommented:
Dear gvsbnarayana,

The example uses neither DBGrid or MSHFlexGrid.
It just creates a grid of objects from 1 object with index of 0. I am unclear on what your trying to do. Do you mean you want to use a DBGrid and set number of rows depending on how many entries the user types?
0
 
gvsbnarayanaAuthor Commented:
Dear  jbil ,
      What I wanted is, just let the user enter as many number of rows here wanted (ofcourse, a limit of 10 or 20) and then I will read those values and do some manipulations and then enter into Database. As I am from Java background, it seems that I am trying to use the DBGrid or MSFlexiGrid(I found DBGrid and MSFlexiGrid when I searched MSDN) in the same way I used in Java. OK. It seems that your code works for my requirement and so, I will try to work on it and will get back to you. It may take some 2 to 3 days !!

Any other suggestions please?
Thanks and Regards,
Badri
0
 
gvsbnarayanaAuthor Commented:
Thanks a lot Mr. jbil !!
It worked fine and I am sorry that I could not spare time till now to accept your answer eventhough I am visiting the site now and then for my other doubts!!
Here are your points!!
Regards,
Badri
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.