I'm trying to build an app to run on top of IBM i (AS400). So far I can get the application to open and login, but I'm looking for a dynamic solution as opposed to using static send keys
Imports System.Threading
Public Class Form1
Dim a As New Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a.StartInfo.FileName = "C:\Program Files\reflection\default scripts\as400.rsf"
a.Start()
Thread.Sleep(3000)
SendKeys.SendWait("UserID {TAB}")
Thread.Sleep(1000)
SendKeys.SendWait("Password {Enter}")
End Sub
End Class
I can run a macro that will display a popup box where the password is entered
Sub Macro1()
'
' Generated by the Reflection Macro Recorder on 03-18-2015 13:03:31.50
' Generated by Reflection for IBM for Windows 8.00
'
With Session
Dim hostpassword As String
.WaitForEvent rcEnterPos, "30", "0", 6, 53
.WaitForDisplayString ".", "30", 6, 49
.TransmitANSI "USERID"
.TransmitTerminalKey rcIBMTabKey
hostpassword = "PASSWORD"
.TransmitANSI hostpassword
.TransmitTerminalKey rcIBMEnterKey
End With
End Sub
I can't just copy and paste that into visual studio and get it to work that way. So my question is how do I get a textbox to inject whatever is typed, into a command line of an external application? I've done a fair amount of research but most everything I've found doesn't apply to what I'm attempting as every tutorial I've found is geared towards MS Office, Excel mostly. Can someone please point me in the right direction?
See the Host Access Class Library Automation Objects.
Here is an example VB script I wrote years ago to reconnect sessions:
Option Explicit
Dim autECLConnList As Object
Dim i As Integer
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
autECLConnList.Refresh
If autECLConnList.Count > 0 Then
For i = 1 to autECLConnList.Count
If autECLConnList(i).CommStarted Then
autECLConnList(i).StopCommunication()
End If
autECLConnList(i).StartCommunication()
Next
End If
Thanks for the reply, however I'm not having any connection issues as the program opens and logs in just fine, I was just trying to figure out how to get text from my form into AS400 and I didn't realize the solution was this simple, I'm very surprised no one answered, or maybe they were waiting for me to figure it out on my own
Imports System.Threading
Public Class Form1
Dim a As New Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a.StartInfo.FileName = "C:\Program Files\reflection\default scripts\as400.rsf"
a.Start()
Thread.Sleep(1000)
SendKeys.SendWait(TextBox1.Text)
Thread.Sleep(1000)
SendKeys.SendWait("{TAB}")
Thread.Sleep(1000)
SendKeys.SendWait(TextBox2.Text)
Thread.Sleep(1000)
SendKeys.SendWait("{ENTER}")
End Sub
End Class
Related
I am developing simple app in visual basic and what I want to do is:
On load whole DataGridView1 is ReadOnly
Next if user will double click on cell, then it turns edit mode for that cell
I try to do this by:
Private Sub CellDouble(ByVal sender As Object,
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellDoubleClick
DataGridView1(e.ColumnIndex, e.RowIndex).ReadOnly = False
DataGridView1.BeginEdit(e.RowIndex)
End Sub
But it doesnt even react. (function is triggered but code not working)
Final step is to Set Read only back to that cell after edit
I simply did:
Private Sub CellDouble(ByVal sender As Object,
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellDoubleClick
DataGridView1.BeginEdit()
End Sub
and it's working fine...
Facing a problem with new Windows Mobile project. I have created a DataSet and added DataSetTableAdapters. Added a query into it and tried to run it and everything worked well. However, when i tried to implement it to my code i get an error
No symbols are loaded for any call stack frame
Where can be a problem???
Here is a code sample:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim username As String
Dim kiekis As Integer
Dim EmpAdapter As DataSet1TableAdapters.EMPTableAdapter
EmpAdapter = New DataSet1TableAdapters.EMPTableAdapter
username = "Petr%"
kiekis = EmpAdapter.Kodas(SCANCODE:=username).Count
Label1.Text = kiekis.ToString()
''MsgBox(kiekis.ToString)
End Sub
And attaching snippet of error - could it be related to Symbol Status where i get error: Cannot find or open the PDB file?
I have created a simple VB 6.0 program to calculate day-to-day sales. I have converted this project into an .exe file where other users can run this program in their terminal to work with, but when they run this exe file they get above mentioned runtime error. Can anyone tell me how to overcome this error?
Dim myobject As Object
Private Sub Command1_Click()
Set myobject = Nothing
Adodc1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.Update
MsgBox "Your Record Updated Successfully!!", vbInformation
End Sub
Private Sub Command3_Click()
Text19.Text = Val(Text11) + Val(Text12) + Val(Text13) + Val(Text14) + Val(Text15)
End Sub
I'm trying to get Volume Serial Number using Visual Basic 2010,
Is there a whole code example that shows me how to do this?
Thanks
I guess the simplest answer to my question was given by:
Hans Passant:
From his link,
I just copied and pasted this function and it works for Microsoft Visual basic 2010 express, Without any modifications
Public Function GetDriveSerialNumber() As String
Dim DriveSerial As Long
Dim fso As Object, Drv As Object
'Create a FileSystemObject object
fso = CreateObject("Scripting.FileSystemObject")
Drv = fso.GetDrive(fso.GetDriveName(AppDomain.CurrentDomain.BaseDirectory))
With Drv
If .IsReady Then
DriveSerial = .SerialNumber
Else '"Drive Not Ready!"
DriveSerial = -1
End If
End With
'Clean up
Drv = Nothing
fso = Nothing
GetDriveSerialNumber = Hex(DriveSerial)
End Function
I would like to thank everyone for their help,
And i apologize for repeating the question,
I did do a google search and a stackflow search,
But my search was"
"get hard drive serial number in visual basic 2010"
So this website did not show up,
Thanks again
This thread here http://social.msdn.microsoft.com/Forums/vstudio/en-US/43281cfa-51c8-4c35-bc31-929c67abd943/getting-drive-volume-serial-number-in-vb-2010 has the following bit of code that you could use/adapt.
I made a piece of code for you to show all drive information.
The Volume serial number is included you can get that by simple
putting some more if's in the code
Imports System.Management
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim drivetype() As String = {"Unknown", "NoRootDirectory", _
"RemoveableDisk", "LocalDisk", "NetworkDrive", "CompactDisk", "RamDisk"}
Dim allDrives() As String = Environment.GetLogicalDrives()
For Each drive In allDrives
Dim win32Drive As String = _
"Win32_LogicalDisk='" & drive.Substring(0, 2) & "'"
Dim Disk As System.Management.ManagementObject _
= New System.Management.ManagementObject(win32Drive)
Me.ListBox1.Items.Add(drive.ToString & drivetype(CInt((Disk("DriveType").ToString))))
For Each diskProperty In Disk.Properties
If Not diskProperty.Value Is Nothing Then
Me.ListBox1.Items.Add("---" & diskProperty.Name & "=" & diskProperty.Value.ToString)
End If
Next
Next
End Sub
End Class
I am trying to write 2 simple subroutines in VB 2010 that could be used with toolstripbutton contorls for multiple textboxes in a form. I know simple copy paste could be done using the textbox1.Copy() and TextBox1.Paste() methodes. What i am trying to do is write a common subroutine which could be used on any textboxes in the form not just one particular textbox.
My codes are below, I know there are errors in it, just wondering how it could be achieved. Any help would be highly appreciated. Thanks.
Public Class Form1
Private Sub copytext()
Dim txt As Control
If TypeOf txt Is TextBox Then
Clipboard.Clear()
Clipboard.SetText(txt.SelectedText)
End If
End Sub
Private Sub pastetext()
Dim txt As Control
If TypeOf txt Is TextBox Then
txt.Text = Clipboard.GetText
End If
End Sub
Private Sub mnuCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCopy.Click
Call copytext()
End Sub
Private Sub mnuPaste_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPaste.Click
Call pastetext()
End Sub
End Class