Getting kinky -- I better run! On Sun, 11 Nov 2007, jaffar wrote: > Date: Sun, 11 Nov 2007 21:39:15 +0800 > From: jaffar <jaffar@xxxxxxxxxxxxx> > Reply-To: programmingblind@xxxxxxxxxxxxx > To: programmingblind@xxxxxxxxxxxxx > Subject: Re: Minimalist fruit basket program in VB2005 > > oo, and whipped too I shouldn't wonder! Cheers! > ----- Original Message ----- > From: "Jamal Mazrui" <empower@xxxxxxxxx> > To: <programmingblind@xxxxxxxxxxxxx> > Sent: Sunday, November 11, 2007 7:35 PM > Subject: RE: Minimalist fruit basket program in VB2005 > > > > And the way fruit cakes get passed around, who knows where I'll end up! > > Jamal > > On > > Sat, 10 Nov 2007, Ken Perry wrote: > > > >> Date: Sat, 10 Nov 2007 22:03:31 -0800 > >> From: Ken Perry <whistler@xxxxxxxxxxxxx> > >> Reply-To: programmingblind@xxxxxxxxxxxxx > >> To: programmingblind@xxxxxxxxxxxxx > >> Subject: RE: Minimalist fruit basket program in VB2005 > >> > >> > >> > >> Grin perfect timing with Christmas coming so close you will be able to > >> sell > >> your self as a present to some unsuspecting person. > >> > >> Ken > >> > >> -----Original Message----- > >> From: programmingblind-bounce@xxxxxxxxxxxxx > >> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui > >> Sent: Saturday, November 10, 2007 5:52 PM > >> To: programmingblind@xxxxxxxxxxxxx > >> Subject: Re: Minimalist fruit basket program in VB2005 > >> > >> Yes, I've turned into a fruit cake! > >> > >> Below is an even shorter VB version that uses a TableLayoutPanel instead > >> of > >> specifying control coordinates. I found that the compiler could not > >> infer > >> types with the AddRange method, so an array of Control objects had to be > >> stated explicitly. Also note that a VB program requires at least one > >> class > >> and a Main method with in it, unlike Boo (or , I think, JScript .NET and > >> Nemerle). VB also needs at least one event handler method whereas C#, > >> Boo, > >> and Nemerle can define an in-line event handler (a method without a name, > >> also called an anonymous delegate). > >> > >> Jamal > >> > >> ' content of vb_fruit.vb > >> ' Fruit Basket program in Visual Basic .NET ' Public domain by Jamal > >> Mazrui > >> > >> ' Import namespace > >> Imports System.Windows.Forms > >> > >> Module FruitBasket > >> ' Initialize controls > >> Dim tlp = new TableLayoutPanel() > >> Dim lblFruit = new Label() > >> Dim txtFruit = new TextBox() > >> Dim WithEvents btnAdd as Button = new Button() Dim lblBasket = new > >> Label() > >> Dim lstBasket = new ListBox() Dim WithEvents btnDelete as Button = new > >> Button() Dim dlg = new Form() > >> > >> ' Define entry point of program > >> Sub Main() > >> ' Specify control properties > >> With tlp > >> .ColumnCount = 3 : .RowCount = 2 : .Parent = dlg .Controls.AddRange( new > >> Control() {lblFruit, txtFruit, btnAdd, lblBasket, lstBasket, btnDelete}) > >> End > >> With > >> > >> lblFruit.Text = "&Fruit:" : lblBasket.Text = "&Basket:" > >> btnAdd.Text = "&Add" : btnDelete.Text = "&Delete" > >> > >> With dlg > >> .Text = "Fruit Basket" : .AcceptButton = btnAdd : .StartPosition = > >> FormStartPosition.CenterScreen : .AutoSize = True : .AutoSizeMode = > >> AutoSizeMode.GrowAndShrink > >> .ShowDialog() > >> End With > >> End Sub > >> > >> ' Define event handler > >> Sub Button_Click(sender as Object, e as EventArgs) Handles btnAdd.Click, > >> btnDelete.Click Select Case sender.Text case "&Add" > >> Dim sFruit = txtFruit.Text > >> if sFruit = "" Then > >> MessageBox.Show("No fruit to add!", "Alert") Return End If > >> > >> lstBasket.Items.Add(sFruit) > >> txtFruit.Text = "" > >> lstBasket.SelectedIndex = lstBasket.Items.Count - 1 > >> > >> Case "&Delete" > >> Dim iFruit = lstBasket.SelectedIndex > >> if iFruit = (-1) Then > >> MessageBox.Show("No fruit to delete.", "Alert") Return End If > >> > >> lstBasket.Items.RemoveAt(iFruit) > >> if iFruit > (lstBasket.Items.Count - 1) Then iFruit = > >> (lstBasket.Items.Count > >> - 1) lstBasket.SelectedIndex = iFruit End Select End Sub End Module > >> > >> > >> __________ > >> View the list's information and change your settings at > >> //www.freelists.org/list/programmingblind > >> > >> __________ > >> View the list's information and change your settings at > >> //www.freelists.org/list/programmingblind > >> > > __________ > > View the list's information and change your settings at > > //www.freelists.org/list/programmingblind > > > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind