Can I pass parameter(s) to a form while opening?

Can I pass parameter(s) to a form while opening?

Anonymous
Not applicable
349 Views
4 Replies
Message 1 of 5

Can I pass parameter(s) to a form while opening?

Anonymous
Not applicable
Can I pass parameter to a form?

I have various combos like cboVessel, cboPump etc. placed on a form and a cmdEdit button.

(1) When user presses cmdEdit button it should open a form appropriate to active combo. i.e. if active control is cboVessel then form for Vessel should be shown. if active control is cboPump then form for Pump should be shown.

(2) Appropriate data also should be shown on appropriate form e.g. if cboVessel contains text 10-V-101 then form for vessel should be shown along with data picked for vessel bearing tag no. 10-V-101.

Part (1) was solved with setting Tag property of cmdEdit to various string values based on Enter event of combo and executing form.show method on click event through select case structure.

But Part (2) sounds very difficult.

Any Help!
TIA
Nimish
0 Likes
350 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Oh yes! I would like to note that it is possible with forms (canvases) of Developer 2000.
0 Likes
Message 3 of 5

Anonymous
Not applicable
Nimish,

In vb/a when you press the cmdEdit, the combo is no longer the active control, so you are not able to choose a form in that way. However, you can use the _click event from the combo to do what you are asking. I would probablly first send control to a sub with the data, and the sub would open the form.

In the form

private sub cboPump_Click()
pressPump(me.cboPump.list(me.cboPump.listindex))
end sub

In another module

sub pressPump(byval sPumpType as string)
frmPumpEdit.txt1.text = spumptype
frmPumpEdit.show
end sub

This assumes you have at least two forms, with the second being named frmPumpEdit. On the frmPumpEdit, there is a textbox named txt1. This should show how to set the value in another form from a first form.

Kilo
0 Likes
Message 4 of 5

Anonymous
Not applicable
For 2, in the Edit click event you can set the
values you need in the  form before you show it. For example, you
can;

 

        ' load the
Vessel Form


size=2>        frmVessel.txtName.Caption
= "what ever you want"

       
frmVessel.show

 

You can also do it in the frmVessel Activate event,
getting the value from your calling form.  

 

Glen


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Can
I pass parameter to a form?

I have various combos like cboVessel, cboPump etc. placed on a form and a
cmdEdit button.

(1) When user presses cmdEdit button it should open a form appropriate to
active combo. i.e. if active control is cboVessel then form for Vessel should
be shown. if active control is cboPump then form for Pump should be shown.

(2) Appropriate data also should be shown on appropriate form e.g. if
cboVessel contains text 10-V-101 then form for vessel should be shown along
with data picked for vessel bearing tag no. 10-V-101.

Part (1) was solved with setting Tag property of cmdEdit to various string
values based on Enter event of combo and executing form.show method on click
event through select case structure.

But Part (2) sounds very difficult.

Any Help!
TIA
Nimish

0 Likes
Message 5 of 5

Anonymous
Not applicable
My preference is to use the value property of the combobox. No matter
how many times the user changes his choice, ect. You can always read the
current selection from the value property in your cmdEdit click event.
You can even pass it directly as an argument to a sub or function that
shows a form.
-Josh

Nimish wrote:

> Can I pass parameter to a form?
>
> I have various combos like cboVessel, cboPump etc. placed on a form and
> a cmdEdit button.
>
> (1) When user presses cmdEdit button it should open a form appropriate
> to active combo. i.e. if active control is cboVessel then form for
> Vessel should be shown. if active control is cboPump then form for Pump
> should be shown.
>
> (2) Appropriate data also should be shown on appropriate form e.g. if
> cboVessel contains text 10-V-101 then form for vessel should be shown
> along with data picked for vessel bearing tag no. 10-V-101.
>
> Part (1) was solved with setting Tag property of cmdEdit to various
> string values based on Enter event of combo and executing form.show
> method on click event through select case structure.
>
> But Part (2) sounds very difficult.
>
> Any Help!
> TIA
> Nimish
>
0 Likes