label text does not change  
Author Message
Tryin2Bgood





PostPosted: Visual C# Language, label text does not change Top

I have this code segment with a SelectedIndex change function..what is suppose to happen is when the choice in the combobox changes, i need the name which is the same value as the combox box to populate a label called "lblVendorCompanyName" i step through the code line for line and my lblVendorCompanyName does get changed to the write name but the label text never changes.....Any help with that...I hope i am being clear


public void BuildVendorDisplay()
{
this.lblVendorCompanyName.Text = _VendorDetail.Vendor.Name;
}

public static void DisplayVendorBuild(int VendorID)
{
VendorOrderLegDetailsForm frmVendorOrderLegs =
new VendorOrderLegDetailsForm();
frmVendorOrderLegs._VendorDetail.VendorID = VendorID;
frmVendorOrderLegs.BuildVendorDisplay();
frmVendorOrderLegs.lblVendorCompanyName.Text = frmVendorOrderLegs._VendorDetail.Vendor.Name;
}
private void cboVendorName_SelectedIndexChanged(object sender, System.EventArgs e)
{
DisplayVendorBuild((
int)cboVendorName.SelectedValue);
}




Visual C#14  
 
 
ahmedilyas





PostPosted: Visual C# Language, label text does not change Top

in the BuildVendorDisplay method's class, where is it obtaining the _VendorDetail.Vendor.Name from Does it have a value

I think you are also doing it twice too:

VendorOrderLegDetailsForm frmVendorOrderLegs = new VendorOrderLegDetailsForm();

frmVendorOrderLegs.BuildVendorDisplay(); //Call1
frmVendorOrderLegs.lblVendorCompanyName.Text = frmVendorOrderLegs._VendorDetail.Vendor.Name; //Call2

Advice:

Check what the value of _VendorDetail.Vendor.Name is.

Remove one call since you are calling the process of changing the text twice. However it shouldnt matter at this stage I believe, my main concern is what the value of _VendorDetail.Vendor.Name is



 
 
Tryin2Bgood





PostPosted: Visual C# Language, label text does not change Top

Yes it get the value of _VendorDetail.Vendor.Name....I was declaring some other static methods that was causing the problem in dealing with my Vendor Object...all is fixed now!