I have a form where the user selects an item from the ListBox. It polls the database based on the ID and returns the correct values to the textboxes on the form.
I've tried a few different ways, all of which returns a null value except the ID.
// Select Mode
private void LstBuildersSelectedIndexChanged(object sender, EventArgs e)
{
var mId = LstBuilders.SelectedIndex + 1;
Accessor.SelectedBuilder(mId, MBuilder, MAddress, MCity, MState, MPhoneNumber, MFaxNumber, MEmailAddress);
TxtBuilderName.Text = MBuilder;
TxtAddress.Text = MAddress;
TxtCity.Text = MCity;
TxtState.Text = MState;
TxtPhoneNumber.Text = MPhoneNumber;
TxtFaxNumber.Text = MFaxNumber;
TxtEmailAddress.Text = MEmailAddress;
}
Accessor.cs
// Selected Builder
public static void SelectedBuilder (int mId, string mBuilder, string mAddress, string mCity, string mState, string mPhoneNumber, string mFaxNumber, string mEmailAddress)
{
var dataConnect = new PxLinqSqlDataContext();
return (from b in dataConnect.GetTable<TblBuilders>()
where (b.IdBuilder == mId)
select // SOMETHING HERE TO MAKE THIS MAGIC WORK
mBuilder = b.BName,
mAddress = b.BAddress,
mCity = b.BCity,
mState = b.BState,
mPhoneNumber = b.BPhoneNumber,
mFaxNumber = b.BFaxNumber,
mEmailAddress = b.BEmailAddress)
)
}







