Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2009, 09:12 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Shinaj
Question Plss Help: Combo Box with Database

Hi, I'm new to VB, and I'm doing my first project, I need help for following..

1) I have a ComboBox in a Form in VB which should be (read only)filled by items(75 items) from a field of a table in MS access databse, I have done databinding but, only first item of the table is visible in the ComboBox. I dont want to use BindingNavigator to step to next item, I'm looking for a drop down comboBox.

2) The project required many Forms, so by clicking a button one form should be closed next Form should appear, I'm using following codes
Form1.Show()
Me.Close()
but, this looks not proffessional as it blinks while opening in different window,
how do i use a parent Form and call all other forms into that form.?

Plsss Help me on this, Pls explain as I'm not expert in VB yet...

Thanks..
 
Old February 4th, 2009, 06:33 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I'm not sure what you are asking about in question 1.

But for question 2, it sounds like you need to build an Multiple Document Interface (MDI) type application. You'll have a master form into which you can open other forms. You can control what get's opened, so basically instead of having multiple forms, you'll just have a single one that is contained in a parent.
__________________
-Peter
compiledthoughts.com
twitter/peterlanoie
 
Old February 7th, 2009, 04:00 AM
Authorized User
 
Join Date: Dec 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Shinaj View Post
Hi, I'm new to VB, and I'm doing my first project, I need help for following..

1) I have a ComboBox in a Form in VB which should be (read only)filled by items(75 items) from a field of a table in MS access databse, I have done databinding but, only first item of the table is visible in the ComboBox. I dont want to use BindingNavigator to step to next item, I'm looking for a drop down comboBox.

2) The project required many Forms, so by clicking a button one form should be closed next Form should appear, I'm using following codes
Form1.Show()
Me.Close()
but, this looks not proffessional as it blinks while opening in different window,
how do i use a parent Form and call all other forms into that form.?

Plsss Help me on this, Pls explain as I'm not expert in VB yet...

Thanks..
Question 1.)
When you query the database with SELECT * FROM you need to get the number of records returned and loop though them adding them to the list.

You can either of the following where rs = RecordSet
Please note Im typing these examples with no compiler so i may make a mistake but it will point you in the right direction.
Code:
For i = 0 to rs.RecordCount -1
ComboBox1.Items.Add(rs.Fields(i).Value)
Next
Code:
        Do
            ComboBox1.Items.Add(rs.Fields("ID").Value)
            rs.MoveNext()
        Loop While Not db.rs.EOF
Question 2) You can either put the code to open the new form in the formclosed event of the opend form or you can put the code to close the previous code in the form load even of the new form. Or you can just use panels and hide them and show them all in one form depending on what you are trying to do.

Last edited by Patrick Cambria; February 7th, 2009 at 04:03 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding data in a combo box from the database Gini Visual Studio 2008 0 June 20th, 2008 02:17 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
dynamic upload a combo box from database on select rashmisrao JSP Basics 4 February 27th, 2006 08:41 AM
Combo Box Populated off Database Firehawk2006 Visual Basic 2005 Basics 1 November 28th, 2005 01:47 PM
Populate a combo box from database w/vbscript morituri VBScript 1 March 1st, 2005 07:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.