[Resolved] Passing datas form form
Hi,
I'm really new in VBA World.
I'm user of Reflection form WRQ who has a VBA support inside.
I've created a form with buttons.
The button has to send a command in the terminal.
I'm using this one
VB Code:
Session.Transmit Me.Cmd3.Text & vbCr
But the value CMD3.Text is only sent AFTER I've closed my Form.
I need to send the command as soon as the user click on the button.
Is there a way to do that ?
(PS : Sorry for bad English)
Cedric
Re: Passing datas form form
Welcome to the Forums.
Do you have a Cmd3_Click event avaliable to you? If so place your code in that procedure to fire the transmission when clicked.
Re: Passing datas form form
Thanks for the answer, but
My button name is GO3
A text field just near this button is call Cmd3
The routine complete is
VB Code:
Private Sub GO3_Click()
Session.Transmit Me.Cmd3.Text & vbCr
Cmd3.BackColor = &H8000000F
End Sub
If i put Cmd3_Click, my button will become useless, no ?
Cedric
Re: Passing datas form form
Sorry for the mixup. Usually there is a naming convection used to help tell whatt the control type is by its prefix name.
Use your code if GO3 is the button name.
Is the event firing? Place a breakpoint on the Private Sub GO3_Click() line.
VB Code:
Private Sub GO3_Click()
Session.Transmit Me.Cmd3.Text & vbCr
Cmd3.BackColor = &H8000000F
End Sub
Re: Passing datas form form
Sorry for not respecting conventions :(
The event itself seems to work.
The command in the text field is sent perfectly. But only after the closing of the form. Not directy. The second line works also (but immediately) (the change of color of the form).
Re: Passing datas form form
Ok, looks like the Session.Transmit is the issue so either its designed that way or there is something else to it.
I am not familar with "Reflection form WRQ" app but do you have any documentation on the Session.Transmit?
Re: Passing datas form form
Here is the help page provided
Code:
Syntax object.Transmit String, [Options]
Description
Transmits a string to the host.
Arguments
String Argument Type: String
Required
Specifies the string to transmit.
Options Argument Type: Enumeration
Optional
Specifies additional behavior for the method. You can combine two or more options using addition as shown here:
.Transmit "Hello", rcNoTranslation + rcIgnoreBlockMode
rcNoTranslation
Indicates that the string should not be translated from the PC character set into the host character set.
rcIgnoreBlockMode
Indicates that keyboard text should be transmitted even if Reflection is in block mode. Without this option, transmitted data goes into display memory when Reflection is in block mode.
rcDecodePassword
Use rcDecodePassword to transmit encoded passwords to the host. Passwords are encoded when they are recorded by the Reflection recorder to ensure that they cannot be read in the source code of the recorded procedure. (The recorder records passwords only when SavePasswords is True.) Encoded passwords are also returned by the GetPassword method. Note: This option is ignored if you are transmitting a password that is not encoded.
rcHexData
Indicates that portions of a string that follow a backslash should be interpreted using either hexadecimal code or C-language character conventions. For example, the following statement displays the fraction symbol ΒΌ (using the decimal code x0BC), followed by a carriage return (using the \r special character).
.Display "\x0BC\r", rcHexData
I've tried with or without the rcIgnoreBlockMode, the result is the same.
and for the object parameter :
Code:
Description
The Session object controls the Reflection session. All of Reflection's methods and properties act on the Session object.
Re: Passing datas form form
Ok, looks like the rcIgnoreBlockMode parameter is what I would have tried too.
How about the Reflection session. Is there something in there that looks like it could set how the transmission is carried out?
Re: Passing datas form form
already looked in the manual, didn't see anything :(
I hope it's possible, all the rest of the interface is finished (creation of the content of all the cmdX fields). Just need to parse them to the console....
Re: Passing datas form form
Ok, one last possibility. How are you displaying your user form? Can you post the code?
Re: Passing datas form form
If I remember (I left the office now until tomorrow)
show.smsform
or
smsform.show (not sure anymore)
called from a macro (single line of code in the macro, between Sub and End Sub).
and the macro called from a menu in the application
(smsform is of course the name of my form)
Cedric
Re: Passing datas form form
In Office VBA, the UserForm.Show method's default state is vbModal.
Try changing this to vbModeless. Just a hunch I guess you could call it
VB Code:
UserForm1.Show vbModeless
Re: Passing datas form form
Damned ! You've saved my life : IT WORKS !!!
Re: [Resolved] Passing datas form form
w00t w00t! I thought that maybe the form was being shown modally (default) and when that happens
it can delay certain messages to/from the form until it is closed. I just was a little unsure since its not a
standard Office VBA app. ;)
Glad to have helped :thumb: