|
-
Nov 19th, 2007, 11:16 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] MSFlexGrid1 and combo box
I have combo box. How I can show the number of row in the data grid base on the number of record selected on combo box?
Last edited by matrik02; Nov 19th, 2007 at 12:00 PM.
-
Nov 19th, 2007, 11:48 AM
#2
Frenzied Member
Re: Datagrid and combo box
Does this Combo box hold the Record Number or any Value from the DB itself.
If its the Record Number, try like Rs.Move(recNumber).
If its a DB Value, then try like Rs.Filter = "MyDBField = " & MyComboVal
Note : Use of Filter was adviced to be eliminated in the Forum . I cant remember the exact case. So use wuth caution. And it needs the recordset to be loaded with correct records first.
-
Nov 19th, 2007, 11:52 AM
#3
Re: Datagrid and combo box
Filter is fine to use on smaller recordsets. For anything large you would want to modify the query to limit returned results.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 19th, 2007, 11:56 AM
#4
Frenzied Member
Re: Datagrid and combo box
 Originally Posted by RobDog888
Filter is fine to use on smaller recordsets. For anything large you would want to modify the query to limit returned results.
@ RobDog888
Just for my information, what do you consider to be a smaller recordset?
-
Nov 19th, 2007, 11:59 AM
#5
Thread Starter
Frenzied Member
Re: MSFlexGrid1 and combo box
I just use this
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
Combo1.AddItem "4"
Sorry guy. I use MSFlexGrid1
-
Nov 19th, 2007, 12:07 PM
#6
Re: MSFlexGrid1 and combo box
@aikidokid, I would say it would also depend on system resources and location of the db. But probably anything in the 10's of thousands of records and up.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 19th, 2007, 12:08 PM
#7
Re: MSFlexGrid1 and combo box
 Originally Posted by matrik02
I just use this
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
Combo1.AddItem "4"
Sorry guy. I use MSFlexGrid1
You can use a loop to add the items with less code.
Code:
Dim i As Integer
For i = 1 To 100
Combo1.AddItem i
Next
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 19th, 2007, 12:13 PM
#8
Frenzied Member
Re: MSFlexGrid1 and combo box
 Originally Posted by RobDog888
@aikidokid, I would say it would also depend on system resources and location of the db. But probably anything in the 10's of thousands of records and up.
Sorry to hyjack this thread matrik02
So with a DB like mine with only 100's or records, and on the same hard drive, this wouldn't be a concern.
-
Nov 19th, 2007, 12:17 PM
#9
Re: MSFlexGrid1 and combo box
No, should be quick and fine. 
Some mid to large size apps use massive databases with sizes up in the Gig range.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 19th, 2007, 12:27 PM
#10
Thread Starter
Frenzied Member
Re: MSFlexGrid1 and combo box
Thank you.
Code:
Dim i As Integer
For i = 1 To 100
Combo1.AddItem i
Next
After that, I want to change the row number in the MSFlexGrid1, when I chose the row number in the combo box during run time.How to do that?
-
Nov 19th, 2007, 03:46 PM
#11
Re: MSFlexGrid1 and combo box
Use the Row and TopRow properties.
Code:
Private Sub Form_Load()
Dim i As Long
MSFlexGrid1.Rows = MSFlexGrid1.FixedRows
For i = 1 To 100
MSFlexGrid1.AddItem i
Combo1.AddItem i
Next i
End Sub
Private Sub Combo1_Click()
MSFlexGrid1.Row = Combo1.Text 'Set current row
MSFlexGrid1.TopRow = MSFlexGrid1.Row 'makes sure row is visible
End Sub
-
Nov 19th, 2007, 03:57 PM
#12
Thread Starter
Frenzied Member
Re: MSFlexGrid1 and combo box
Actually I would like to set the row number..
If I choose number two in the combo1..MSFlexGrid1 with have 2 row.
If I choose number seven in the combo1..MSFlexGrid1 with have seven row
and so on..
How to do that?
-
Nov 19th, 2007, 05:21 PM
#13
Re: MSFlexGrid1 and combo box
Actually I would like to set the row number..
You mean you want to set the number of rows in the grid.
MSFlexgrid1.Rows = CLng(Combo1.Text) + MSFlexGrid1.FixedRows
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|