I didn't see any attachments on your first 9/22/05 post.
Here is my SP and code.
CREATE PROCEDURE dbo.mytest AS select top 10 * from sportsman
GO
// frmDataEntry
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.LightSteelBlue;
this.ClientSize = new System.Drawing.Size(800, 816);
this.ControlBox = false;
this.Controls.Add(this.cmdClear);
this.Controls.Add(this.cmdCompleted);
this.Controls.Add(this.GroupBox3);
this.Controls.Add(this.grpSportsman);
this.Controls.Add(this.grpSearchDealerNum);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this. Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmDataEntry";
this.Text = "Dealer Sales";
this.Load += new System.EventHandler(this.frmDataEntry_Load);
this.GroupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.d gPrivileges)).EndInit();
this.grpSportsman.ResumeLayout(false);
this.GroupBox2.ResumeLayout(false);
this.grpSearchDealerNum.ResumeLayout(false);
this.ResumeLayout(false);
private void txtLicYear_TextChanged(object sender, System.EventArgs e)
{
string sConnString =
System.Configuration.ConfigurationSettings.AppSett ings["dsn"];
string sProc = "prGet_LicenseCode";
using (SqlConnection oCn = new SqlConnection(sConnString))
{
using (SqlCommand oCmd = new SqlCommand(sProc, oCn))
{
oCn.Open();
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.Parameters.Add("@sLicenseYear", SqlDbType.NChar, 6);
oCmd.Parameters["@sLicenseYear"].Value = txtLicYear.Text;
SqlDataAdapter oDa = new SqlDataAdapter();
oDa.SelectCommand = oCmd;
DataSet ds=new DataSet();
oDa.Fill(ds);
int numTables = ds.Tables.Count;
//No table no records.
if (numTables < 1)
{
MessageBox.Show("No License Codes found for that year.", "No record
found", MessageBoxButtons.OK);
}
else
{
cboPrivilege.DataSource = ds.Tables[0];
cboPrivilege.DisplayMember = "LICENSE_CODE";
cboPrivilege.ValueMember = "SALES_REV_KEY";
cboPrivilege.SelectedIndex = -1;
DataTable dtGrid = ds.Tables[0].Clone();
dgPrivileges.DataSource = dtGrid;
}
}
}
}
""Jeffrey Tan[MSFT]"" wrote:
Hi Cadel,
Thanks for your feedback.
I am not sure how to get this conclusion. Have you tried the sample project
I attached in last reply? In that sample project, I try to add a new
TextBox, and set the TabIndex so that it receive the focus first. When
running the project, my combobox will not display the first record at all,
it will display a empty entry.
Can you provide some more information to help us reproduce your problem?
Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.