'Complete listing of sample MapObjects code referenced
'on page 60 of the July-September 1999 issue of ArcUser Magazine

'Since IMAGEGRID requires an input image filename and an output grid filename, the textboxes to enter the parameters  can be concatenated.  The results can then be displayed in a list box.

'The second step is to automate the ArcInfo command PROJECT to describe the input projection and assign a new output projection.  The following code prompts you for the input and output projection parameters and puts them into a list.  The list of projection parameters is then executed using the PushString command.  The Lost Focus procedure is used on the text boxes in order to skip parameters that are not needed for a particular projection.
 
Private Sub Command1_Click()
Dim Arc As New Esri.Arc
Dim results As New Esriutil.Strings
Dim sev As Byte
Dim j As Integer
For j = 0 To List2.ListCount   '--- This is the total number of items in List
  Arc.PushString List2.List(j) '--- Returns the string for the specified list item.
Next j
sev = Arc.Command("project Grid " & Text20.Text & " " & Text21.Text, results) * 200
Dim I As Integer
For I = 0 To results.Count - 1
    List1.AddItem results.Item(I)
Next I
End Sub

Private Sub Command2_Click()
List2.AddItem "Input "
End Sub

Private Sub Command3_Click()
List2.AddItem "Output "
End Sub

Private Sub Command4_Click()
List2.AddItem "Parameters "
End Sub

Private Sub Command5_Click()
List2.AddItem "End "
End Sub

Private Sub Text11_LostFocus()
If Text11 = "" Then
  Exit Sub
Else
List2.AddItem "Projection " & Text11
End If
End Sub

Private Sub Text12_LostFocus()
If Text12 = "" Then
  Exit Sub
Else
List2.AddItem "Units " & Text12
End If
End Sub

Private Sub Text13_LostFocus()
If Text13 = "" Then
  Exit Sub
Else
List2.AddItem "Zone " & Text13
End If
End Sub

Private Sub Text14_LostFocus()
If Text14 = "" Then
  Exit Sub
Else
List2.AddItem "Datum " & Text14
End If
End Sub

Private Sub Text15_LostFocus()
If Text15 = "" Then
  Exit Sub
Else
List2.AddItem "Spheroid " & Text15
End If
End Sub

Private Sub Text16_LostFocus()
If Text16 = "" Then
  Exit Sub
Else
List2.AddItem "Xshift " & Text16
End If
End Sub

Private Sub Text17_LostFocus()
If Text17 = "" Then
  Exit Sub
Else
List2.AddItem "Yshift " & Text17
End If
End Sub

Private Sub Text2_LostFocus()
If Text2 = "" Then
  Exit Sub
Else
List2.AddItem "Projection " & Text2
End If
End Sub

Private Sub Text3_LostFocus()
If Text3 = "" Then
  Exit Sub
Else
List2.AddItem "Units " & Text3
End If
End Sub

Private Sub Text4_LostFocus()
If Text4 = "" Then
  Exit Sub
Else
List2.AddItem "Zone " & Text4
End If
End Sub

Private Sub Text5_LostFocus()
If Text5 = "" Then
  Exit Sub
Else
List2.AddItem "Datum " & Text5
End If
End Sub

Private Sub Text6_LostFocus()
If Text6 = "" Then
  Exit Sub
Else
List2.AddItem "Spheroid " & Text6
End If
End Sub

Private Sub Text7_LostFocus()
If Text7 = "" Then
  Exit Sub
Else
List2.AddItem "Xshift " & Text7
End If
End Sub

Private Sub Text8_LostFocus()
If Text8 = "" Then
  Exit Sub
Else
List2.AddItem "Yshift " & Text8
End If
End Sub