Solved

How to create a Grid?

Posted on 2002-03-19
5
251 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:gvsbnarayana
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 50 total points
ID: 6880093
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
 
LVL 8

Author Comment

by:gvsbnarayana
ID: 6880127
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
 
LVL 3

Expert Comment

by:jbil
ID: 6880156
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
 
LVL 8

Author Comment

by:gvsbnarayana
ID: 6881770
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
 
LVL 8

Author Comment

by:gvsbnarayana
ID: 7049272
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now