this is a little jumbled because of how I did the loops but what I want to do is move the output to another textbox each time variable plants reaches 18 (i want 18 plants per text box)
If anyone can point me in the right direction for this problem please do
I know a lot of this is inefficient but this is all just temporary until I figure certain things out about the code.
copy/pasting it over screwed up some of the spacing, I do realize that DoWhile needs a space in between
If anyone can point me in the right direction for this problem please do
I know a lot of this is inefficient but this is all just temporary until I figure certain things out about the code.
VB.NET:
[COLOR=#0000ff]Public [/COLOR][COLOR=#0000ff]Class[/COLOR][B] Form1[/B]
[COLOR=#0000ff]Structure[/COLOR][B] Student[/B]
[COLOR=#0000ff]Dim[/COLOR][B] strName [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]String[/COLOR]
[COLOR=#0000ff]Dim[/COLOR][B] intPetunias [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]Integer[/COLOR]
[COLOR=#0000ff]Dim[/COLOR][B] intGlads [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]Integer[/COLOR]
[COLOR=#0000ff]Dim[/COLOR][B] intIrises [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]Integer[/COLOR]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]Structure[/COLOR]
[COLOR=#0000ff]Dim[/COLOR][B] Billy [/B][COLOR=#0000ff]As[/COLOR][B] Student[/B]
[COLOR=#0000ff]Dim[/COLOR][B] Sally [/B][COLOR=#0000ff]As[/COLOR][B] Student[/B]
[COLOR=#0000ff]Private[/COLOR][COLOR=#0000ff]Sub[/COLOR][B] Form1_Load([/B][COLOR=#0000ff]ByVal[/COLOR][B] sender [/B][COLOR=#0000ff]As[/COLOR][B] System.Object, [/B][COLOR=#0000ff]ByVal[/COLOR][B] e [/B][COLOR=#0000ff]As[/COLOR][B] System.EventArgs) [/B][COLOR=#0000ff]Handles[/COLOR][COLOR=#0000ff]MyBase[/COLOR][B].Load[/B]
[B]Billy.strName = [/B][COLOR=#800000]"Billy"[/COLOR]
[B]Billy.intPetunias = 0[/B]
[B]Billy.intIrises = 0[/B]
[B]Billy.intGlads = 0[/B]
[B]Sally.strName = [/B][COLOR=#800000]"Sally"[/COLOR]
[B]Sally.intPetunias = 0[/B]
[B]Sally.intIrises = 0[/B]
[B]Sally.intGlads = 0[/B]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]Sub[/COLOR]
[COLOR=#0000ff]Private[/COLOR][COLOR=#0000ff]Sub[/COLOR][B] cmdOk_Click([/B][COLOR=#0000ff]ByVal[/COLOR][B] sender [/B][COLOR=#0000ff]As[/COLOR][B] System.Object, [/B][COLOR=#0000ff]ByVal[/COLOR][B] e [/B][COLOR=#0000ff]As[/COLOR][B] System.EventArgs) [/B][COLOR=#0000ff]Handles[/COLOR][B] cmdOk.Click[/B]
[B]txtDisplay.Clear()[/B]
[COLOR=#0000ff]Dim[/COLOR][B] counter [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]Integer[/COLOR]
[COLOR=#0000ff]Dim[/COLOR][B] countto [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]Integer[/COLOR]
[COLOR=#0000ff]Dim[/COLOR][B] plants [/B][COLOR=#0000ff]As[/COLOR][COLOR=#0000ff]Integer[/COLOR][B] = 0[/B]
[COLOR=#0000ff]If[/COLOR][B] txtName.Text = [/B][COLOR=#800000]"Billy"[/COLOR][COLOR=#0000ff]Then[/COLOR]
[COLOR=#0000ff]With[/COLOR][B] Billy[/B]
[B].intPetunias += [/B][COLOR=#0000ff]Integer[/COLOR][B].Parse(txtPetunias.Text)[/B]
[B].intGlads += [/B][COLOR=#0000ff]Integer[/COLOR][B].Parse(txtGlads.Text)[/B]
[B].intIrises += [/B][COLOR=#0000ff]Integer[/COLOR][B].Parse(txtIrises.Text)[/B]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]With[/COLOR]
[COLOR=#0000ff]ElseIf[/COLOR][B] txtName.Text = [/B][COLOR=#800000]"Sally"[/COLOR][COLOR=#0000ff]Then[/COLOR]
[COLOR=#0000ff]With[/COLOR][B] Sally[/B]
[B].intPetunias += [/B][COLOR=#0000ff]Integer[/COLOR][B].Parse(txtPetunias.Text)[/B]
[B].intGlads += [/B][COLOR=#0000ff]Integer[/COLOR][B].Parse(txtGlads.Text)[/B]
[B].intIrises += [/B][COLOR=#0000ff]Integer[/COLOR][B].Parse(txtIrises.Text)[/B]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]With[/COLOR]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]If[/COLOR]
[B]counter = 1[/B]
[B]countto = Billy.intPetunias[/B]
[COLOR=#0000ff]Do[/COLOR][COLOR=#0000ff]While[/COLOR][B] counter <= countto[/B]
[B]txtDisplay.Text &= [/B][COLOR=#800000]"Billy Petunia"[/COLOR][B] & ControlChars.NewLine[/B]
[B]counter += 1[/B]
[B]plants += 1[/B]
[COLOR=#0000ff]Loop[/COLOR]
[B]counter = 1[/B]
[B]countto = Billy.intGlads[/B]
[COLOR=#0000ff]Do[/COLOR][COLOR=#0000ff]While[/COLOR][B] counter <= countto[/B]
[B]txtDisplay.Text &= [/B][COLOR=#800000]"Billy Gladiolus"[/COLOR][B] & ControlChars.NewLine[/B]
[B]counter += 1[/B]
[B]plants += 1[/B]
[COLOR=#0000ff]Loop[/COLOR]
[B]counter = 1[/B]
[B]countto = Billy.intIrises[/B]
[COLOR=#0000ff]Do[/COLOR][COLOR=#0000ff]While[/COLOR][B] counter <= countto[/B]
[B]txtDisplay.Text &= [/B][COLOR=#800000]"Billy Iris"[/COLOR][B] & ControlChars.NewLine[/B]
[B]counter += 1[/B]
[B]plants += 1[/B]
[COLOR=#0000ff]Loop[/COLOR]
[B]counter = 1[/B]
[B]countto = Sally.intPetunias[/B]
[COLOR=#0000ff]Do[/COLOR][COLOR=#0000ff]While[/COLOR][B] counter <= countto[/B]
[B]txtDisplay.Text &= [/B][COLOR=#800000]"Sally Petunia"[/COLOR][B] & ControlChars.NewLine[/B]
[B]counter += 1[/B]
[B]plants += 1[/B]
[COLOR=#0000ff]Loop[/COLOR]
[B]counter = 1[/B]
[B]countto = Sally.intGlads[/B]
[COLOR=#0000ff]Do[/COLOR][COLOR=#0000ff]While[/COLOR][B] counter <= countto[/B]
[B]txtDisplay.Text &= [/B][COLOR=#800000]"Sally Gladiolus"[/COLOR][B] & ControlChars.NewLine[/B]
[B]counter += 1[/B]
[B]plants += 1[/B]
[COLOR=#0000ff]Loop[/COLOR]
[B]counter = 1[/B]
[B]countto = Sally.intIrises[/B]
[COLOR=#0000ff]Do[/COLOR][COLOR=#0000ff]While[/COLOR][B] counter <= countto[/B]
[B]txtDisplay.Text &= [/B][COLOR=#800000]"Sally Iris"[/COLOR][B] & ControlChars.NewLine[/B]
[B]counter += 1[/B]
[B]plants += 1[/B]
[COLOR=#0000ff]Loop[/COLOR]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]Sub[/COLOR]
[COLOR=#0000ff]End[/COLOR][COLOR=#0000ff]Class[/COLOR]
copy/pasting it over screwed up some of the spacing, I do realize that DoWhile needs a space in between
Last edited: