vb.net - VB 2008 Transferring stored values to textbox after initial textbox value is cleared -
self teaching vb beginner here.
i have data entry section includes...
2 comboboxes(cbx_trucktype, cbx_doornumber)
-------cbx_trucktype having 2 options (inbound, outbound)
-------cbx_doornumber having 3 options (door 1, door 2, door 3)
2 textboxes (txb_customername, txb_ordernumber)
-------txb_customername hold customer name
-------txb_ordernumber hold order number
and finally...
a button(btn_entertruck) transfers text comboxes , textboxes following...
2 tabs
the 1st tab has
2 buttons(btn_door1, btn_door2)
btn_door1 has 3 corresponding textboxes
-------txb_trucktypedoor1, txb_customernamedoor1, txb_ordernumberdoor1
btn_door2 has 3 corresponding textboxes
-------txb_trucktypedoor2, txb_customernamedoor2, txb_ordernumberdoor2
the 2nd tab has
1 button(btn_door3)
btn_door1 has 3 corresponding textboxes
-------txb_trucktypedoor3, txb_customernamedoor3, txb_ordernumberdoor3
currently, have code (that works question had!) that, upon btn_entertruck.click, transfer text corresponding textboxes.
here's problem...
i've coded msgbox pop-up (when inbound selected cbx_trucktype) asking if there outbound. if click "yes", inputbox pops-up , asks order number. button transfers inbound information textboxes , stores outbound order number.
when click btn_door1(or 2 or 3), clears text corresponding textboxes. (using me.controls)
( add code of above, figure moot point, because works)
what want happen...
i want have stored outbound number saved reference door number corresponds to. upon btn_doorx click, fill order number corresponding textbox. don't need text stored/saved when app closed.
and have no idea how that.
*after tooling, i've done following, not work"
i declared these @ class level.
dim str_sametruckpodoor1, str_sametruckpodoor2, str_sametruckpodoor3 string
this code in btn_entertruck event
dim str_erroutdoorname string = cbx_doornumber.text dim str_outbounddoorname string = str_erroutdoorname.replace(" ", "") dim arrayforponumbers control() = me.controls.find("str_sametruckpo" & str_outbounddoorname, true) if cbx_trucktype.text = "inbound" dim outboundmsg = "is there outbound truck information?" dim title = "outbound?" dim style = msgboxstyle.yesno or msgboxstyle.defaultbutton2 or _ msgboxstyle.question dim response = msgbox(outboundmsg, style, title) if response = msgboxresult.yes dim needpomessage, needpotitle, defaultvalue string dim ponumberoutbound string ' set prompt. needpomessage = "enter po number" ' set title. needpotitle = "po# outbound" defaultvalue = "?" ' set default value. ' display message, title, , default value. ponumberoutbound = inputbox(needpomessage, needpotitle, defaultvalue) ' if user has clicked cancel, set myvalue defaultvalue if ponumberoutbound "" ponumberoutbound = defaultvalue arrayforponumbers(0) = ponumberoutbound end if end if
i'm getting error message on
arrayforponumbers(0) = ponumberoutbound ' cannot convert string .controls
and have following code in btn_door1 event - handles btn_door2, btn_door3
dim whichbutton button = ctype(sender, button) dim str_errdoorname string = whichbutton.name dim str_doorname string = str_errdoorname.replace("btn_", "") dim str_doortype control() = me.controls.find("txb_" & str_doorname & "type", true) dim str_customer control() = me.controls.find("txb_" & str_doorname & "customer", true) dim str_ordernumber control() = me.controls.find("txb_" & str_doorname & "ordernumber", true) dim secondarrayforponumbers control() = me.controls.find("str_sametruckpo" & str_doorname, true) if str_doortype(0).text = "outbound" str_doortype(0).text = "" str_customer(0).text = "" str_ordernumber(0).text = "" elseif secondarrayforponumbers(0).text.length > 0 str_doortype(0).text = "outbound" str_ordernumber(0).text = me.controls("str_sametruckpo" & str_doorname).text end if
any appreciated. if i'm not clear on i'm asking or haven't given enough details, please let me know.
edit: added info based on comment, added code, changed title
how long want data stored? ie: longer life of open application? if application closed alright if data lost? if not, may want consider writing data external database.
Comments
Post a Comment