TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jim 0
NA
5
0
comboBox Binding issue
Apr 12 2004 2:45 PM
I cannot get the comboBox to display the array fields. My Console.Writeline is writing data correctly so I am connected to the database correctly. Any suggestions will be greatly appreciated. Jim using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.IO; using System.Text; using System.Data.OleDb; using System.Data; namespace mdisample { ///
/// Summary description for property. ///
public class property : System.Windows.Forms.Form { private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.Label label2; ///
/// Required designer variable. ///
private System.ComponentModel.Container components = null; public property() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } ///
/// Clean up any resources being used. ///
protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code ///
/// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///
private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); this.label2 = new System.Windows.Forms.Label(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.AutoScroll = true; this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.comboBox1); this.panel1.Controls.Add(this.label1); this.panel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.panel1.Location = new System.Drawing.Point(8, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(600, 300); this.panel1.TabIndex = 0; // // label2 // this.label2.Location = new System.Drawing.Point(144, 56); this.label2.Name = "label2"; this.label2.TabIndex = 2; // // comboBox1 // this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.Location = new System.Drawing.Point(288, 56); this.comboBox1.MaxDropDownItems = 20; this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(216, 21); this.comboBox1.Sorted = true; this.comboBox1.TabIndex = 1; // // label1 // this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.label1.Location = new System.Drawing.Point(248, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(304, 16); this.label1.TabIndex = 0; this.label1.Text = "Please select the Zipcode you are looking for."; // // property // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(680, 273); this.Controls.Add(this.panel1); this.Name = "property"; this.Text = "Property"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.property_Load); this.panel1.ResumeLayout(false); this.ResumeLayout(false); } #endregion /*================================================ * Directory scanner Not used because we bind to the DB * ===============================================*/ void DirToLbox(string targetPath, ListBox myListBox) { // create an array to hold the subdirectories ArrayList sArray=new ArrayList(); // create an array to hold the list of files ArrayList fArray=new ArrayList(); // get information about our initial directory DirectoryInfo dirInfo=new DirectoryInfo(targetPath); // retrieve array of files & subdirectories FileSystemInfo[] myDir=dirInfo.GetFileSystemInfos(); for (int i=0; i
0 )) sArray.Add(Path.GetFileName(myDir[i].FullName) + "\\"); else fArray.Add(Path.GetFileName(myDir[i].FullName)); } // sort the subdirectories alphabetically sArray.Sort(0,sArray.Count,null); // sort the files alphabetically fArray.Sort(0,fArray.Count,null); // ensure that the listbox has no items beforehand myListBox.Items.Clear(); // insert the sorted subdirectories into the listbox for (int i=0; i
Reply
Answers (
3
)
Help me in how to pass values between forms
IDE Output Window (Need to catch compile errors)