unit WinForm; interface uses System.Drawing, System.Collections, System.ComponentModel, System.Windows.Forms, System.Data; type TWinForm = class(System.Windows.Forms.Form) {$REGION 'Designer Managed Code'} strict private /// /// Required designer variable. /// Components: System.ComponentModel.Container; Button1: System.Windows.Forms.Button; Label1: System.Windows.Forms.Label; ComboBox1: System.Windows.Forms.ComboBox; /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// procedure InitializeComponent; procedure Button1_Click(sender: System.Object; e: System.EventArgs); procedure TWinForm_Load(sender: System.Object; e: System.EventArgs); {$ENDREGION} strict protected /// /// Clean up any resources being used. /// procedure Dispose(Disposing: Boolean); override; private { Private Declarations } public constructor Create; end; [assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))] implementation {$AUTOBOX ON} {$REGION 'Windows Form Designer generated code'} /// /// Required method for Designer support -- do not modify /// the contents of this method with the code editor. /// procedure TWinForm.InitializeComponent; begin Self.Button1 := System.Windows.Forms.Button.Create; Self.Label1 := System.Windows.Forms.Label.Create; Self.ComboBox1 := System.Windows.Forms.ComboBox.Create; Self.SuspendLayout; // // Button1 // Self.Button1.Font := System.Drawing.Font.Create('Microsoft Sans Serif', 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0))); Self.Button1.Location := System.Drawing.Point.Create(92, 200); Self.Button1.Name := 'Button1'; Self.Button1.Size := System.Drawing.Size.Create(112, 32); Self.Button1.TabIndex := 0; Self.Button1.Text := '&Calculate'; Include(Self.Button1.Click, Self.Button1_Click); // // Label1 // Self.Label1.BorderStyle := System.Windows.Forms.BorderStyle.Fixed3D; Self.Label1.Font := System.Drawing.Font.Create('Microsoft Sans Serif', 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0))); Self.Label1.Location := System.Drawing.Point.Create(24, 40); Self.Label1.Name := 'Label1'; Self.Label1.Size := System.Drawing.Size.Create(248, 32); Self.Label1.TabIndex := 1; Self.Label1.Text := 'The drop down menu is empty'; Self.Label1.TextAlign := System.Drawing.ContentAlignment.MiddleCenter; // // ComboBox1 // Self.ComboBox1.Font := System.Drawing.Font.Create('Microsoft Sans Serif', 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (Byte(0))); Self.ComboBox1.Location := System.Drawing.Point.Create(72, 120); Self.ComboBox1.Name := 'ComboBox1'; Self.ComboBox1.Size := System.Drawing.Size.Create(152, 28); Self.ComboBox1.TabIndex := 2; Self.ComboBox1.Text := 'Click me'; // // TWinForm // Self.AutoScaleBaseSize := System.Drawing.Size.Create(5, 13); Self.ClientSize := System.Drawing.Size.Create(292, 273); Self.Controls.Add(Self.ComboBox1); Self.Controls.Add(Self.Label1); Self.Controls.Add(Self.Button1); Self.FormBorderStyle := System.Windows.Forms.FormBorderStyle.Fixed3D; Self.MaximizeBox := False; Self.Name := 'TWinForm'; Self.StartPosition := System.Windows.Forms.FormStartPosition.CenterScreen; Self.Text := 'Split String'; Include(Self.Load, Self.TWinForm_Load); Self.ResumeLayout(False); end; {$ENDREGION} procedure TWinForm.Dispose(Disposing: Boolean); begin if Disposing then begin if Components <> nil then Components.Dispose(); end; inherited Dispose(Disposing); end; constructor TWinForm.Create; begin inherited Create; // // Required for Windows Form Designer support // InitializeComponent; // // TODO: Add any constructor code after InitializeComponent call // end; procedure TWinForm.TWinForm_Load(sender: System.Object; e: System.EventArgs); begin end; procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs); var strName : string; strTemp : string; i : integer; x : integer; begin strName := 'joe;paul;john;jose;elena;'; self.Label1.Text := strName; self.ComboBox1.Items.Clear; for i := 1 to strName.Length do begin if strName[i] <> ';' then begin strTemp := strTemp + strName[i]; end else begin self.ComboBox1.Items.Add(strTemp); strTemp := ''; x := x + 1; end; end; Messagebox.Show('Combo Box updated with '+x.ToString+' names'); end; end.