Click here to Skip to main content
15,908,013 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Scrolling two DataGrids with one Scrollbar Pin
BuddelWilli18-Feb-05 1:00
BuddelWilli18-Feb-05 1:00 
GeneralPlz,I need your help Pin
sara_2217-Feb-05 20:50
sara_2217-Feb-05 20:50 
GeneralRe: Plz,I need your help Pin
rajith200518-Feb-05 6:57
rajith200518-Feb-05 6:57 
GeneralRe: Plz,I need your help Pin
sara_2218-Feb-05 10:05
sara_2218-Feb-05 10:05 
GeneralRe: Plz,I need your help Pin
rajith200519-Feb-05 7:12
rajith200519-Feb-05 7:12 
GeneralRe: Plz,I need your help Pin
Bad Sector20-Feb-05 23:35
Bad Sector20-Feb-05 23:35 
GeneralRe: Plz,I need your help Pin
sara_2221-Feb-05 1:31
sara_2221-Feb-05 1:31 
GeneralUsing DataGrid or ListView Control to replace MSFlexGrid Pin
dyerstein17-Feb-05 11:31
dyerstein17-Feb-05 11:31 
OK, I'm working on a project and I have come stuck on one important feature of my application. A brief backgroud is that this is a trading application, my problem/question comes when I try replace the MS FlexGrid with the DataGrid. I am trying to acheive the same effect with this function using the datagrid, but I just cant seem to get it work correctly, here are the methods:



'================================================================================
' Public Methods
' ===============================================================================
'--------------------------------------------------------------------------------
' Adds the market depth row to the book
'--------------------------------------------------------------------------------
Public Sub updateMktDepth(ByVal tickerId As Integer, ByVal rowId As Long, ByVal marketMaker As String, _
ByVal operation As Long, ByVal side As Long, ByVal price As Double, ByVal size As Long)
Dim bookentry As String
bookentry = marketMaker & vbTab & price & vbTab & size & vbTab & "0.0" & vbTab & "0"

If operation = OPERATION_INSERT Then
If side = BID Then
grdBidBookEntries.AddItem bookentry, rowId + 1
Else
grdAskBookEntries.AddItem bookentry, rowId + 1
End If
ElseIf operation = OPERATION_UPDATE Then
If side = BID Then
grdBidBookEntries.RemoveItem rowId + 1
grdBidBookEntries.AddItem bookentry, rowId + 1
Else
grdAskBookEntries.RemoveItem rowId + 1
grdAskBookEntries.AddItem bookentry, rowId + 1
End If
ElseIf operation = OPERATION_DELETE Then
If side = BID Then
grdBidBookEntries.RemoveItem rowId + 1
Else
grdAskBookEntries.RemoveItem rowId + 1
End If
End If

' recalc the average cost and cumulative size
Call UpdateLists
End Sub
________________________________
'--------------------------------------------------------------------------------
' Flush the deep book
'--------------------------------------------------------------------------------
Private Sub Form_Load()
Dim bookentry As String

' flush the book entries and add the column headers
grdAskBookEntries.Clear
grdBidBookEntries.Clear
bookentry = "MM" & vbTab & "Price" & vbTab & "Size" & vbTab & "cumSize" & vbTab & "avgPrice"
grdAskBookEntries.AddItem bookentry
grdBidBookEntries.AddItem bookentry
End Sub


Private Sub UpdateList(ByVal lstBookEntries As MSFlexGrid)
' need to recalc the cum

Dim val As String
Dim size As Integer, cumSize As Integer
Dim price As Double, totalPrice As Double
Dim iLoop As Integer, jLoop As Integer

For iLoop = 1 To lstBookEntries.Rows - 1
'Calculate the cumulative size & average price
cumSize = 0
totalPrice = 0

For jLoop = 1 To iLoop
lstBookEntries.row = jLoop
lstBookEntries.Col = 1
price = lstBookEntries.Text
lstBookEntries.Col = 2
size = lstBookEntries.Text
cumSize = cumSize + size
totalPrice = totalPrice + (price * size)
Next jLoop
lstBookEntries.row = iLoop
lstBookEntries.Col = 3
lstBookEntries.Text = cumSize
lstBookEntries.Col = 4
lstBookEntries.Text = Round((totalPrice / cumSize), 4)
Next iLoop
End Sub

___________________________________________________

P.S Market Depth just shows the best 10bids and the best10 offers, when I try to implement the same using a datagrid, it does not disply correctly, any suggestions welcomed!

GeneralRe: Using DataGrid or ListView Control to replace MSFlexGrid Pin
Dave Kreskowiak18-Feb-05 8:59
mveDave Kreskowiak18-Feb-05 8:59 
GeneralRe: Using DataGrid or ListView Control to replace MSFlexGrid Pin
dyerstein20-Feb-05 14:05
dyerstein20-Feb-05 14:05 
GeneralPassword expire Pin
Anonymous17-Feb-05 10:17
Anonymous17-Feb-05 10:17 
GeneralRe: Password expire Pin
Gavin Jeffrey17-Feb-05 10:44
Gavin Jeffrey17-Feb-05 10:44 
GeneralRe: Password expire Pin
Anonymous17-Feb-05 10:52
Anonymous17-Feb-05 10:52 
GeneralRe: Password expire Pin
Dave Kreskowiak17-Feb-05 11:24
mveDave Kreskowiak17-Feb-05 11:24 
GeneralmenuItem mouseOver event Pin
Anonymous17-Feb-05 9:58
Anonymous17-Feb-05 9:58 
GeneralRe: menuItem mouseOver event Pin
Anonymous17-Feb-05 10:03
Anonymous17-Feb-05 10:03 
GeneralFreeze column in a datagrid scroll Pin
Ron317-Feb-05 7:19
Ron317-Feb-05 7:19 
Generalexposing nested classes via webservices Pin
detroitboy17-Feb-05 5:18
detroitboy17-Feb-05 5:18 
Generalreferencing windows form in a variable Pin
Anonymous17-Feb-05 4:42
Anonymous17-Feb-05 4:42 
GeneralRe: referencing windows form in a variable Pin
Colin Angus Mackay17-Feb-05 5:04
Colin Angus Mackay17-Feb-05 5:04 
GeneralRe: referencing windows form in a variable Pin
Anonymous17-Feb-05 7:22
Anonymous17-Feb-05 7:22 
GeneralRe: referencing windows form in a variable Pin
Anonymous17-Feb-05 8:09
Anonymous17-Feb-05 8:09 
GeneralRe: referencing windows form in a variable Pin
Colin Angus Mackay17-Feb-05 8:25
Colin Angus Mackay17-Feb-05 8:25 
GeneralRe: referencing windows form in a variable Pin
Anonymous17-Feb-05 8:34
Anonymous17-Feb-05 8:34 
Generalproblem with writing into a struct Pin
Dahoolio17-Feb-05 2:49
Dahoolio17-Feb-05 2:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.