Skip to content

Instantly share code, notes, and snippets.

@illgitthat
Created April 3, 2015 21:23
Show Gist options
  • Select an option

  • Save illgitthat/3f660dfa1e6555e1e4af to your computer and use it in GitHub Desktop.

Select an option

Save illgitthat/3f660dfa1e6555e1e4af to your computer and use it in GitHub Desktop.
submit button
Private Sub SubmitButton_Click(sender As Object, e As EventArgs) Handles SubmitButton.Click
If QuantityTextBox.Text < 0 Then
MsgBox("You must provide a numerica value greater than 0")
'EXIT SUB HERE, how?
End If
Dim newTradeRequest As New TradeRequest(StockComboBox.SelectedItem, TradeTypeComboBox.SelectedItem, CInt(QuantityTextBox.Text))
newTradeRequest.StoreRequest(stockConnection)
End Sub
Public Sub StoreRequest(ByVal conn As OleDbConnection)
Dim request As OleDbCommand = New OleDbCommand()
request.Connection = conn
request.CommandText = "insert into Orders(Ticker, DateRequested, TimeRequested, OrderType, TradeQuantity, OrderStatus) values('" & Ticker & "','" & CStr(RequestDate.Date) & "','" & RequestDate.ToString("hh:mm:ss") & "','" & OrderType & "','" & Quantity & "','" & Status & "')"
Dim numOfRecords As Integer = request.ExecuteNonQuery()
If numOfRecords = 1 Then
MsgBox("A new trade request has been added successfully.")
Else
MsgBox("Failed to add a new trade request.")
End If
Form1.TradingRequestsListBox.Refresh()
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment