-
Nov 3rd, 2021, 08:50 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Question on existing VB6 code I am trying to convert to .NET
Hi. Five years ago I ported our company's customer service application from VB6 to .NET. It turns out I missed a routine so when users were double-clicking a row in a grid, the new .NET code wasn't doing what the VB6 code would've done.
Not really a big deal because there was a way around it, but when one of the two people who do this particular operation mentioned it to me I said Whoops and got right on it.
Now for the question because I am not really sure how to convert this. In VB6 the grid is declared like so:
Code:
Begin MSFlexGridLib.MSFlexGrid flxSOLines
Height = 1995
Left = 0
TabIndex = 125
Top = 0
Width = 9795
_ExtentX = 17277
_ExtentY = 3519
_Version = 393216
FixedCols = 0
BackColorBkg = -2147483633
End
The routine I am trying to convert goes like this:
Code:
Private Sub flxSOLines_DblClick()
With flxSOLines
R = .Row
AssignSLinetoObject SONumber, .TextMatrix(R, 12), "T", Control
If P21Mode = True Then
If .TextMatrix(R, 25) = "LABOR" Then
AssignEmp "T", SONumber.Caption, .TextMatrix(R, 12), 0, 0, EmployeeID.Text
LoadSOLines flxSOLines, SONumber, Control
Else
'Do ask if you want to overrite slm here
If flxSOLines.TextMatrix(R, 26) > 0 Or flxSOLines.CellBackColor = vbGrayText Then
.TextMatrix(R, 7) = "T"
Exit Sub
End If
End If
End If
.TextMatrix(R, 7) = "T"
End With
I am stuck on that test that's bolded. If flxSOLines is an entire grid and this routine fires when you double click a row, exactly what cell is it testing to see if the background color is grey? How can CellBackColor even be a property of the grid? Would this test ever be true? It is possible the original programmer made a mistake and wrote code that doesn't do anything. And perhaps more possible that I just don't understand this. Thank you!
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Nov 3rd, 2021, 09:01 AM
#2
Re: Question on existing VB6 code I am trying to convert to .NET
The .CellBackColor is reflecting to the current active cell, thus the Row and Column
When (double) clicking the FlexGrid the selected .Row and .Col properties are
So in this case the .Row and .Col values point to the clicked cell.
-
Nov 3rd, 2021, 09:57 AM
#3
Thread Starter
PowerPoster
Re: Question on existing VB6 code I am trying to convert to .NET
Yes, I understand. Obviously when you are double-clicking a row it's really a cell that the cursor is in!
All set, thank you!
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|