VB syntax for MapInfo

Idly I used to create applications nyoba GIS (Geographic Information System) which uses MapInfo, MapBasic, and Visual Basic 6.0. The plan makes the existing laboratory information system at my college. Would not want to be so since the deadline at the top. Fadwas so real. Alhamdulillah application so and can run pretty well(although still very much needs to be fixed). This application is able to locate, update, delete, and insert the data into MapInfo through the interface created in Visual Basic. For those who want to learn more, here is an example of Visual Basic syntax for MapInfo ...


Public Mapinfo As Object
Public gagalbukaobjek As Integer
Public openmap As String
Public apppath As String
 
Private Sub Command1_Click()
End
End Sub
 
Private Sub Command10_Click()
frmgedungABH.Show
Me.Visible = False
End Sub
 
Private Sub Command11_Click()
frmlogin.Show
frmlogin.txtpass.Text = ""
frmlogin.txtuser.Text = ""
frmlogin.txtuser.SetFocus
Me.Visible = False
End Sub
 
Private Sub Command2_Click()
frmgedungC.Show
Me.Hide
End Sub
 
Private Sub Command3_Click()
frmgedungC.Show
Me.Hide
End Sub
 
Private Sub Command4_Click()
frminformatika.Show
Me.Hide
End Sub
 
Private Sub Command5_Click()
frmgedungC.Show
Me.Hide
End Sub
 
Private Sub Command6_Click()
frmelco.Show
End Sub
 
Private Sub Command7_Click()
frmgedungABH.Show
Me.Visible = False
End Sub
 
Private Sub Command8_Click()
frmgedungABH.Show
Me.Visible = False
End Sub
 
Private Sub Command9_Click()
frmgedungABH.Show
Me.Visible = False
End Sub
 
Private Sub Form_Load()
StatusBar1.Panels(2) = "Date : " & Date
 
Set Mapinfo = CreateObject("MapInfo.Application")
If gagalbukaobjek Then
Set Mapinfo = CreateObject("MapInfo.Application")
End If
Mapinfo.do "set window info parent " & frmMain.semuagedung.hWnd
apppath = LCase(App.Path)
If (Right$(App.Path, 1) <> "\") Then
apppath = apppath + "\"
End If
Mapinfo.do "Set Application Window " & frmMain.semuagedung.hWnd
 
Mapinfo.do "Set Next Document Parent " & frmMain.semuagedung.hWnd & "style 1"
openmap = "Run Application """ + apppath + "semuagedung.wor" + """"
Mapinfo.do openmap
 
End Sub
 
Private Sub opt_A_Click()
Dim gdgA As String
'If Len(opt_A.Caption) > 0 Then
If opt_A.Enabled = True Then
gdgA = "Gedung A"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgA & """"
End If
'njaluk tulung ditandai yo nggon petane
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.8"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgA + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_B_Click()
Dim gdgB As String
If Len(opt_B.Caption) > 0 Then
gdgB = "Gedung B"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgB & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.8"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgB + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_C_Click()
Dim gdgC As String
If Len(Opt_C.Caption) > 0 Then
gdgC = "Gedung C"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgC & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.8"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgC + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_D_Click()
Dim gdgD As String
If Len(opt_D.Caption) > 0 Then
gdgD = "Gedung D"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgD & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 1.0"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgD + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_E_Click()
Dim gdgE As String
If Len(opt_E.Caption) > 0 Then
gdgE = "Gedung E"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgE & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 1.0"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgE + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_F_Click()
Dim gdgF As String
If Len(opt_F.Caption) > 0 Then
gdgF = "Gedung F"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgF & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgF + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_G_Click()
Dim gdgG As String
If Len(opt_G.Caption) > 0 Then
gdgG = "Gedung G"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgG & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgG + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_H_Click()
Dim gdgH As String
If Len(opt_H.Caption) > 0 Then
gdgH = "Gedung H"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgH & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgH + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_I_Click()
Dim gdgI As String
If Len(opt_I.Caption) > 0 Then
gdgI = "Gedung Business Center"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgI & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgI + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_J_Click()
Dim gdgJ As String
If Len(opt_J.Caption) > 0 Then
gdgJ = "Kantin"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgJ & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgJ + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_K_Click()
Dim gdgK As String
If Len(opt_K.Caption) > 0 Then
gdgK = "Gedung K"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgK & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgK + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_L_Click()
Dim gdgL As String
If Len(opt_L.Caption) > 0 Then
gdgL = "Gedung L"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgL & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgL + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_LC_Click()
Dim gdgLC As String
If Len(opt_LC.Caption) > 0 Then
gdgLC = "Gedung Learning Center"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgLC & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgLC + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_SC_Click()
Dim gdgSC As String
If Len(opt_SC.Caption) > 0 Then
gdgSC = "Gedung Student Center"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgSC & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgSC + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub opt_MSU_Click()
Dim gdgMSU As String
If Len(opt_MSU.Caption) > 0 Then
gdgMSU = "Masjid Syamsul Ulum"
frmMain.Mapinfo.do "Find Using denah_ittelkom (nama)"
frmMain.Mapinfo.do "Find """ & gdgMSU & """"
End If
If (Val(frmMain.Mapinfo.eval("CommandInfo(3)")) >= 1) Then
frmMain.Mapinfo.do "Set map zoom 0.7"
End If
frmMain.Mapinfo.do "Select * from  denah_ittelkom where nama = """ + gdgMSU + """"
Label15.Caption = frmMain.Mapinfo.eval("denah_ittelkom.keterangan")
End Sub
 
Private Sub StatusBar1_PanelClick(ByVal Panel As MSComctlLib.Panel)
If StatusBar1.Panels(7).Enabled = True Then
frmAbout.Show
End If
End Sub
 
Private Sub Timer1_Timer()
StatusBar1.Panels(3) = "Time :" & Time
End Sub
 
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
 
Case Is = "zoomin":
Mapinfo.runmenucommand 1705
 
Case Is = "zoomout":
Mapinfo.runmenucommand 1706
 
Case Is = "info":
Mapinfo.runmenucommand 1707
 
Case Is = "layerctrl":
Mapinfo.runmenucommand 801
 
Case Is = "select":
Mapinfo.runmenucommand 1701
 
Case Is = "deselect":
Mapinfo.runmenucommand 304
 
Case Is = "label":
Mapinfo.runmenucommand 1708
 
Case Is = "grabber":
Mapinfo.runmenucommand 1702
 
Case Is = "open":
Mapinfo.runmenucommand 102
 
Case Is = "save":
Mapinfo.runmenucommand 109
 
End Select
End Sub