Automated Part Lot Creation?

I have the following code which I'm using to create new part lots, based on values picked up from a customised version of table UD10:

Private sub createBox

dim newLotPanel as boolean
_orderNum = txtJobNum.text

if _orderNum <> "" then
_lotID = "Box:" & _orderNum
_lotDesc = "Box lot for SO " & _orderNum
_partNum = txtPartNum.text
partLotAdapter = New LotSelectUpdateAdapter(UD10Form)

newLotPanel = partLotAdapter.InvokeNewLotDialog(_partNum, _lotID)
if newLotPanel then
dim lotsDataSet as Data.Dataset = partLotAdapter.GetData(_partNum, _lotID)
'lotsDataSet.PartLot(0).PartLotDescription = _lotDesc

end if

Catch ex as exception,"Exception",messageboxbuttons.OK, messageboxicon.error)
End try

else"No job number selected","Error",messageboxbuttons.OK, messageboxicon.error)
exit sub
End if

End sub

This works inasmuch as a new part lot is created for the correct part but I have a question
The above code produces a dialog box on screen where I can enter a description for the new lot and also potentially alter the lot ID.
If I attempt to enter a description into this box as soon as I touch a key it throws an exception.
Is there a way of creating the new lot without having to go through this dialog box ?