Newbie Userform questions: Userform to variables

Majawat

New member
Joined
Feb 8, 2013
Messages
1
Reaction score
0
Points
0
CrossPosted from Mr.Excel.com after getting no responses in a week: mrexcel-com/forum/excel-questions/683157-newbie-userform-questions-userform-variables.html
(I can't post links yet, hence the not correct url)


I appologize if this has been discussed elsewhere, I did a quick search on here and didn't come back with anything that suits my needs. Moreover, I've also searched google as well.

I just started using Userforms today. I've used Visual Basic before so I understand some about the theory about them, but am having trouble using them inside Excel 2010 to gather data.

I'm looking for a brief tutorial on using Userforms as a variable input, basically.

I have a collection (called BeerList) of a custom class called BeerType. The BeerType object (a variable called Beer in my sheet) has several varibles as one would expect: BeerName, Volume, Price, ABV, Style, etc.

After creating the UserForm (ManualAdd), I have the necessary TextBoxes/ComboBoxes to enter and a Submit and Done button.

My overal goal is to prompt for the information, fill in the variables, add to collection, ask for more data, and stop if asked.

Pseudocode:
Code:
Do 
     ManualAdd.show
     if ManualAdd.btnSubmit = clicked then
          beer.Name = ManualAdd.txtName
          beer.ABV = ManualAdd.txtABV
          beer.Volume = ManualAdd.Volume
          'other variables as needed
     end if

     ManualAdd.Controls.ClearContents

     BeerList.add beer

Loop Until ManualAdd.btnDone = Clicked

Please help, and thank you so much for your time! If I haven't provided enough information, please let me know and I will give more.
 
Back
Top