grievesy

I am trying to send data to a new form and the open the form. I have tried visible = true and the show() method but both seem to have trouble opening the form completely. The form semi appears but never finishes. i am very new to programming but i can make it open a msgbox no problem and clicking on a button also works.. PLEASE take a look

Public Class PopUpStart
Inherits System.Windows.Forms.Form
Public WithEvents MyOB As EccoDotNet.OrderBook
Public Mybuysell As String
Public MyContract As String
Public MyFQty As Integer
Public MyOQty As Integer
Public MyPrice As Integer

Private Sub bPopUpStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bPopUpStart.Click
MyOB = New EccoDotNet.OrderBook
lblStarted.text = "STARTED"
End Sub

Public Sub MyOB_OnOrderFill(ByVal Id As Integer, ByVal OrderContractDescription As String, ByVal OrderBuySell As EccoDotNet.BuySell, ByVal WorkingQuantity As Integer, ByVal FilledQuantity As Integer, ByVal OrderPrice As Integer, ByVal Status As EccoDotNet.OrderStatus, ByVal Legged As Boolean, ByVal FillContractDescription As String, ByVal FillBuySell As EccoDotNet.BuySell, ByVal FillQuantity As Integer, ByVal FillPrice As Integer) Handles MyOB.OnOrderFill
Select Case OrderBuySell
Case EccoDotNet.BuySell.Buy
Mybuysell = "BUY"
Case EccoDotNet.BuySell.Sell
Mybuysell = "SELL"
Case Else
Mybuysell = "DOH"
End Select
MyContract = FillContractDescription
MyFQty = FillQuantity
MyOQty = FillQuantity + WorkingQuantity
MyPrice = FillPrice
'MsgBox("" & FillContractDescription & " " & " " & Mybuysell & " " & FillQuantity & " " & " " & FillPrice)
popup()
End Sub

Private Sub bPopUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bPopUp.Click
Dim myfillpopup = New FillPopUp
FillPopUp.lblContract.Text = MyContract
FillPopUp.lblBuySell.Text = Mybuysell
FillPopUp.lblFQty.Text = MyFQty
FillPopUp.lblOQty.Text = MyOQty
FillPopUp.lblPrice.Text = MyPrice
FillPopUp.Visible = True
End Sub
Sub popup()
Dim myfillpopup = New FillPopUp
FillPopUp.lblContract.Text = MyContract
FillPopUp.lblBuySell.Text = Mybuysell
FillPopUp.lblFQty.Text = MyFQty
FillPopUp.lblOQty.Text = MyOQty
FillPopUp.lblPrice.Text = MyPrice
FillPopUp.Show()
End Sub

End Class



Re: Visual Basic Language event launches a form but the form doesnt open completely

ShyamN

Sub popup()
Dim myfillpopup = New FillPopUp
myFillPopUp.lblContract.Text = MyContract
myFillPopUp.lblBuySell.Text = Mybuysell
myFillPopUp.lblFQty.Text = MyFQty
myFillPopUp.lblOQty.Text = MyOQty
myFillPopUp.lblPrice.Text = MyPrice
myFillPopUp.Show()
End Sub


I think changes like above should fix the problem i.e. in the code that you have posted, you are trying to set fields on a type rather than an instance (i.e. object) of that type.

Also, I think it is probably a good idea to strongly type your variables as below.

Dim myfillpopup As FillPopUp = New FillPopUp

This will probably help you get a better intelisense experience and the compiler will report errors if you have a typo eg. if you have

myFillPopUp.Shop() 'Shop instead of Show


Hope this helps.
Shyam






Re: Visual Basic Language event launches a form but the form doesnt open completely

grievesy

Thanks for you reply but unfortunately same result..
The form tries to open i.e. the outline is clear with the active title bar. but the main form section is partially drawn.. if i try and x out that form it says it is not responding.....

cheers





Re: Visual Basic Language event launches a form but the form doesnt open completely

Vano

We would appreciate if you post the FillPopUp code into this thread. I think, error is rather located there than here (many generations of VB programmers used the pattern you use to call the form, so it is not very likely to be wrong ). Also try myFillPopup.ShowDialog().




Re: Visual Basic Language event launches a form but the form doesnt open completely

grievesy

i dont have much in here...
Public Class FillPopUp

Private Sub bClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bClose.Click
Me.Close()
End Sub
End Class

Thanks for all the help..




Re: Visual Basic Language event launches a form but the form doesnt open completely

grievesy

cheers everyone -
the myFillPopUp.ShowDialog()
worked..