Jag ställer en fråga på morgonen och sedan rullar det in information under dagen som ligger i en förändra färg i en Datagrid utan att ställa nya frågor ?
array "THLC_tr1.LOUT(oob1, 1)"
jag har två problem 1.
värdet blir alltid större än vad det är ? så att den visar grönt ?
denna ligger i
Public Class Koplong
Inherits DataGridTextBoxColumn
Declare Function MessageBeep Lib "user32.dll" (ByVal wType As Long) As Long
Public nro_C As Double
Protected Overloads Overrides Sub paint(ByVal graph As Graphics, ByVal restbounds As Rectangle, ByVal curmngrSrc As CurrencyManager, ByVal Rownumber As Integer, ByVal forecolorBrush As Brush, ByVal Backcolorbrush As Brush, ByVal alignementright As Boolean)
Dim objval As Object
objval = Me.GetColumnValueAtRow(curmngrSrc, Rownumber)
If Not (IsNothing(objval) Or IsDBNull(objval)) Then
Dim cellvalue As Decimal
cellvalue = CType(objval, Decimal)
If (cellvalue > 0 And cellvalue > nro_C) Then
Backcolorbrush = Brushes.Black
forecolorBrush = Brushes.ForestGreen
Beep()
Else
Backcolorbrush = Brushes.Black
forecolorBrush = Brushes.White
End If
End If
MyBase.paint(graph, restbounds, curmngrSrc, Rownumber, forecolorBrush, Backcolorbrush, alignementright)
End Sub
Det som hämtar på morgonen
Private Sub Lstk_1_3(ByVal dtg As DataGrid, ByVal tsp As String, ByVal objj As String)
Dim MSDATASET As New DataSet
Dim MPDAD As SqlDataAdapter
Dim MTBL As New DataTable
' TextBox2.Text = "Start " & Now
Dim cn As New SqlConnection
cn.ConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Forex_Trading;Data Source=Dator1;Packet Size=4096;Workstation ID=dator1"
Dim obadapter As New SqlDataAdapter
Dim objdatas As DataSet = New DataSet
cn.Open()
obadapter.SelectCommand = New SqlCommand
obadapter.SelectCommand.Connection = cn
obadapter.SelectCommand.CommandText = "signalerK" & objj & tsp
Dim OPAR1 As SqlParameter = obadapter.SelectCommand.Parameters.Add("@tidsp", SqlDbType.NVarChar)
OPAR1.Value = tiidsp
Dim OPAR2 As SqlParameter = obadapter.SelectCommand.Parameters.Add("@typ", SqlDbType.NVarChar)
OPAR2.Value = "k"
Dim OPAR3 As SqlParameter = obadapter.SelectCommand.Parameters.Add("@ant", SqlDbType.Int)
OPAR3.Value = 2
obadapter.SelectCommand.CommandType = CommandType.StoredProcedure
obadapter.SelectCommand.ExecuteNonQuery()
obadapter.Fill(objdatas, "TR@EC")
cn.Close()
obadapter = Nothing
cn = Nothing
Dim obdt As New DataGridTableStyle
Dim obtc As New dbassign_DG
Dim colbtc As New kopcolumn_i
Dim obtc1 As New dbassign_DG
Dim obtc2 As New Koplong
' Dim obtc As New Koplong
colbtc.MappingName = "ant"
colbtc.HeaderText = "ant"
colbtc.Width = 25
obdt.GridColumnStyles.Add(colbtc)
obtc2.MappingName = "om_R"
obtc2.HeaderText = "OM_R"
obtc2.Width = 40
obtc2.nro_C = THLC_tr1.LOUT(oob1, 1)
obdt.GridColumnStyles.Add(obtc2)
obtc.MappingName = "pro"
obtc.HeaderText = "pro"
obtc.Width = 40
obdt.GridColumnStyles.Add(obtc)
dtg.TableStyles.Add(obdt)
dtg.DataSource = objdatas
dtg.DataMember = "TR@EC"
' DataGrid5.PreferredColumnWidth = 40
dtg.CaptionText = "Köpsignal 3 " & tsp
dtg.CaptionBackColor = Color.Blue
dtg.CaptionForeColor = Color.Black
dtg.Show()
Me.Invalidate(True)
End Sub
Detta fungerar mycket bra.************************
Public Class kopcolumn_i
Inherits DataGridTextBoxColumn
Declare Function MessageBeep Lib "user32.dll" (ByVal wType As Long) As Long
Protected Overloads Overrides Sub paint(ByVal graph As Graphics, ByVal restbounds As Rectangle, ByVal curmngrSrc As CurrencyManager, ByVal Rownumber As Integer, ByVal forecolorBrush As Brush, ByVal Backcolorbrush As Brush, ByVal alignementright As Boolean)
Dim objval As Object
objval = Me.GetColumnValueAtRow(curmngrSrc, Rownumber)
If Not (IsNothing(objval) Or IsDBNull(objval)) Then
Dim cellvalue As Integer
cellvalue = CType(objval, Integer)
If (cellvalue > 0) Then
Backcolorbrush = Brushes.Black
forecolorBrush = Brushes.ForestGreen
Beep()
Else
Backcolorbrush = Brushes.Black
forecolorBrush = Brushes.White
End If
End If
MyBase.paint(graph, restbounds, curmngrSrc, Rownumber, forecolorBrush, Backcolorbrush, alignementright)
End Sub
Är Tacksam om jag får hjälp Mvh Per H