That said I would like to ask for your thoughts on organization, possible optimization, better ways to do things (like store the data), etc.
And thanks in advance for your constructive criticism ... this is how I best learn new languages, by trying something and then asking the experts for comments ...

Code: Select all
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Text_0
#Text_1
#Text_2
#Text_4
#Text_5
#Text_6
#Text_7
#String_Name
#String_Address
#String_City
#String_State
#String_ZIP
#String_Email
#String_CallSign
#CheckBox_ARESInfo
#CheckBox_LicInfo
#Button_0
#Button_1
#Text_Counter
#Text_Confirm
EndEnumeration
Global Quit.b = #False
Global flength.l = 0
Procedure countlines()
flength = 0
If OpenFile(0, "c:\purebasicwork\safetyfair\efair2.txt")
While Eof(0)=0
flength+1
ReadString(0)
Wend
CloseFile(0)
EndIf
EndProcedure
Procedure clear_fields()
SetGadgetText(#String_Name, "")
SetGadgetText(#String_Address, "")
SetGadgetText(#String_City, "")
SetGadgetText(#String_State, "WA")
SetGadgetText(#String_ZIP, "")
SetGadgetText(#String_Email, "")
SetGadgetText(#String_CallSign, "")
SetGadgetState(#CheckBox_ARESInfo, #PB_Checkbox_Unchecked)
SetGadgetState(#CheckBox_LicInfo, #PB_Checkbox_Unchecked)
EndProcedure
Procedure MainProc()
If OpenWindow(#Window_0, 389, 176, 759, 397, "TC ARES - Emergency Preparedness Expo 2010", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
TextGadget(#Text_0, 120, 60, 100, 20, "Name ", #PB_Text_Right)
TextGadget(#Text_1, 110, 90, 110, 20, "Mailing Address ", #PB_Text_Right)
TextGadget(#Text_2, 110, 120, 110, 20, "City ", #PB_Text_Right)
TextGadget(#Text_4, 360, 120, 50, 20, "State", #PB_Text_Right)
TextGadget(#Text_5, 500, 120, 70, 20, "Zip Code", #PB_Text_Right)
TextGadget(#Text_6, 100, 150, 120, 20, "Email ", #PB_Text_Right)
TextGadget(#Text_7, 100, 180, 120, 20, "Ham Call sign (if any) ", #PB_Text_Right)
StringGadget(#String_Name, 220, 60, 160, 20, "")
StringGadget(#String_Address, 220, 90, 230, 20, "")
StringGadget(#String_City, 220, 120, 120, 20, "")
StringGadget(#String_State, 420, 120, 30, 20, "WA")
StringGadget(#String_ZIP, 580, 120, 90, 20, "")
StringGadget(#String_Email, 220, 150, 190, 20, "")
StringGadget(#String_CallSign, 220, 180, 120, 20, "")
CheckBoxGadget(#CheckBox_ARESInfo, 220, 220, 260, 20, "Please send me ARES membership information")
CheckBoxGadget(#CheckBox_LicInfo, 220, 250, 290, 20, "Please send me information on obtaining a ham license")
ButtonGadget(#Button_0, 350, 310, 80, 40, "Add Me!")
ButtonGadget(#Button_1, 670, 360, 50, 20, "Exit")
TextGadget(#Text_Counter, 20, 360, 30, 20, "", #PB_Text_Center)
TextGadget(#Text_Confirm, 660, 330, 70, 20, "")
SetActiveGadget(#String_Name)
countlines()
SetGadgetText(#Text_Counter, Str(flength))
Repeat
Event.l = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #Button_0
ares$ = ""
license$ = ""
name$ = GetGadgetText(#String_Name)
address$ = GetGadgetText(#String_Address)
city$ = GetGadgetText(#String_City)
state$ = GetGadgetText(#String_State)
zip$ = GetGadgetText(#String_ZIP)
email$ = GetGadgetText(#String_Email)
csign$ = GetGadgetText(#String_CallSign)
If GetGadgetState(#CheckBox_ARESInfo) = #PB_Checkbox_Checked
ares$ = "ARES YES"
EndIf
If GetGadgetState(#CheckBox_LicInfo) = #PB_Checkbox_Checked
license$ = "LICENSE YES"
EndIf
newentry.s = name$ + "|" + address$ + "|" + city$ + "|" + state$ + "|";
newentry = newentry + zip$ + "|" + email$ + "|" + csign$ + "|"
newentry = newentry + ares$ + "|" + license$
If OpenFile(0, "c:\purebasicwork\safetyfair\efair2.txt" )
FileSeek(0, Lof(0))
WriteStringN(0, newentry)
CloseFile(0)
Else
MessageRequester("FATAL ERROR!", "Unable to oopen or create output file!!!", #PB_MessageRequester_Ok)
Quit = #True
EndIf
countlines()
SetGadgetText(#Text_Counter, Str(flength))
clear_fields()
SetActiveGadget(#String_Name)
Case #Button_1
Quit = #True
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow Or Quit = #True
EndIf
EndProcedure
MainProc() ; program entry point
; IDE Options = PureBasic 4.50 (Windows - x86)
; CursorPosition = 60
; FirstLine = 51
; Folding = -
; EnableXP