[Gtk-sharp-list] Combobox clear and reload

henkdp henk at bbd.co.za
Thu Oct 9 12:58:37 EDT 2008


Good day,

I am a total newbie to Monodevelop Stetic and GTK#. :blush: I have searched
high and low on the internet and this forum, don't know if I am looking for
wrong key words but here is my problem.

I want to create a ComboBoxEntry widget with employees in it, I populate it
with values from the database, nothing fancy and I managed that. However,
when a new employee is added I want to clear the ComboBoxEntry and recreate
it, I don't just want to append the new value at the bottom.

Here, to explain is a snippet of my code loading the ComboboxEntry:

   protected void LoadEmployeeCombo()
   {
      //Load the employee details
      
      DataTable datatableEmployeeDropDown =
business.StartUpLoadEmployeeDetails();
      foreach  (DataRow  r in datatableEmployeeDropDown.Rows )
      {
         string empnumber = r["empnumber"].ToString();
         
         string nickname = r["nickname"].ToString();
         string trim_nickname = nickname.Trim();

         string surname = r["surname"].ToString();
         string trim_surname = surname.Trim();
         
         string employeeNumberAndName = ( empnumber + " - " + trim_nickname
+ " " + trim_surname );
         
         HTEmpNocomboboxentry.AppendText( employeeNumberAndName );
      }

      //Add this to the top of the combo entry box for when a new employee
is needed
      HTEmpNocomboboxentry.PrependText("New - type new employee number " );
     
   }

As I said nothing fancy and you can see from the code I am a real newbie!
:-D

I would really appreciate any help with this.

Thank you very much,
Henk du Plessis

-- 
View this message in context: http://www.nabble.com/Combobox-clear-and-reload-tp19903032p19903032.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list