Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to create a Grid?

Posted on 2002-03-19
5
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 150 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Suggested Courses

636 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