unreadable forms

  • Thread starter Thread starter Won Lee
  • Start date Start date
W

Won Lee

I made my own from which is similiar to a MsgBox but allows for
positioning on the screen.
If I call the class from a button event it works fine.

The form, however, becomes unreadable if I call it from an event handler
that I attach to a datastream. Anybody know why?
 
* Won Lee said:
I made my own from which is similiar to a MsgBox but allows for
positioning on the screen.

If I call the class from a button event it works fine.

The form, however, becomes unreadable if I call it from an event
handler that I attach to a datastream.

Post your code.
 
Won Lee said:
I made my own from which is similiar to a MsgBox but allows for
positioning on the screen.
If I call the class from a button event it works fine.

The form, however, becomes unreadable if I call it from an event
handler that I attach to a datastream. Anybody know why?

What does "unreadable" mean? How do you show the Form in both cases? Do you
have multiple threads running?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Unreadable means that the outline of the box is there but the content,
which is a label and a button does not show up.
Yes the application is multi-threaded. I tried to google how to make
the application into a single thread just for the form call and I
couldn'd find any info that I understood.

Here is the code

Sub CallAlertBox(ByVal symbol As String)
Dim col As Integer = 8
Dim row As Integer = 10
If (form_counter Mod col = 0) Then
x = 0
y = y + 90
If (form_counter = 0 Or form_counter Mod row * col = 0) Then
y = 0
End If
Else
x = x + 160
End If
Dim ab As New AlertBox(symbol, x, y)
ab.Show()
form_counter = form_counter + 1
If form_counter = row * col Then
x = 0
y = 0
End If
End Sub

AlertBox is just a form with a label and a button on it.

Here is the method that calls CallAlertBox

Sub HandleData(ByVal source As Object, ByVal dataArgs As DataEventArgs)
Dim data As RawData
Dim block As IDataBlock
Dim row As IRow
'Dim field As IField
Dim item As String
'Dim type As String
Dim change As Decimal
Dim net_change As Decimal
Dim last_price As Decimal
Dim symbol As String
data = dataArgs.Data
item = dataArgs.Item
block = data.GetDataAsBlock()
Try
row = block.Item(0)
If row.Count = 3 Then
symbol = row(0).StringValue
last_price = row(2).PriceValue.DecimalValue
change = row(1).PriceValue.DecimalValue
net_change = Math.Round((change / (last_price + (-1 *
change))) * 100, 2)
If net_change >= 2.0 Then
RemoveItem(item, symbol)
MarkAlerted(symbol)
'CallAlertBox(symbol)
End If
End If
Catch ex As Exception
Console.WriteLine(ex)
End Try
End Sub
 
Back
Top