Solved

How to create a Grid?

Posted on 2002-03-19
5
249 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

757 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

19 Experts available now in Live!

Get 1:1 Help Now