Plz if any one can hlp me ,,i want to change this vb 6 code to vb.net after upgrading i had so much trouble about coordinate system changes in vb.net......... ...here is my code...
[code=vbnet]
Private Sub AddColumn(DrawS tr As String, szPos As String, DrawControl As Control)
'drawstr contains name of column to be drawn
'szpos contains name of column with respect to which the column is drawn
'Add column to DrawControl
Dim ds As Recordset
Dim dss As Recordset
Dim X As Single
Dim Y As Single
Set ds = CurDb.OpenRecor dset("Columns", dbOpenDynaset)
Search = "Cname='" + DrawStr + "'" 'String to search for entry of column in drawstr
ds.FindFirst Search
Set dss = CurDb.OpenRecor dset("Columns", dbOpenDynaset)
Csstr = "Cname='" + szPos + "'"
dss.FindFirst Csstr
X = ds(4)
Y = ds(5)
If X + JUSTFACT > DrawControl.Sca leLeft + DrawControl.Sca leWidth Or X - JUSTFACT < DrawControl.Sca leLeft Or Y + JUSTFACT > DrawControl.Sca leTop Or Y - JUSTFACT < DrawControl.Sca leTop + DrawControl.Sca leHeight Then
If MainAdd Then
Adjustmain
Else
Column_Draw DrawControl
End If
Exit Sub
End If
DrawControl.Lin e (dss(4), dss(5))-(ds(4), ds(5))
FlushDistances ds, X, Y
If StrComp(Left$(D rawStr, 1), "C") = 0 Then
Select Case ds(1)
Case "H"
DrawControl.Lin e (X - ds(2) / 2, Y - ds(3) / 2)-(X + ds(2) / 2, Y + ds(3) / 2), , BF
Case "C"
DrawControl.Fil lStyle = 0
DrawControl.Cir cle (X, Y), ds(2)
DrawControl.Fil lStyle = 1
End Select
Else
Select Case ds(1)
Case "H"
DrawControl.Lin e (X - ds(2) / 2, Y - ds(3) / 2)-(X + ds(2) / 2, Y + ds(3) / 2), , B
End Select
End If
If Main Then
Column_Dis ds(4) + ds(2) / 2, ds(5) - ds(3) / 2, ds(0), DrawControl
End If
ds.Close
dss.Close
'Stop
'DrawDiagonal DrawControl
End Sub[/code]
[code=vbnet]
Private Sub AddColumn(DrawS tr As String, szPos As String, DrawControl As Control)
'drawstr contains name of column to be drawn
'szpos contains name of column with respect to which the column is drawn
'Add column to DrawControl
Dim ds As Recordset
Dim dss As Recordset
Dim X As Single
Dim Y As Single
Set ds = CurDb.OpenRecor dset("Columns", dbOpenDynaset)
Search = "Cname='" + DrawStr + "'" 'String to search for entry of column in drawstr
ds.FindFirst Search
Set dss = CurDb.OpenRecor dset("Columns", dbOpenDynaset)
Csstr = "Cname='" + szPos + "'"
dss.FindFirst Csstr
X = ds(4)
Y = ds(5)
If X + JUSTFACT > DrawControl.Sca leLeft + DrawControl.Sca leWidth Or X - JUSTFACT < DrawControl.Sca leLeft Or Y + JUSTFACT > DrawControl.Sca leTop Or Y - JUSTFACT < DrawControl.Sca leTop + DrawControl.Sca leHeight Then
If MainAdd Then
Adjustmain
Else
Column_Draw DrawControl
End If
Exit Sub
End If
DrawControl.Lin e (dss(4), dss(5))-(ds(4), ds(5))
FlushDistances ds, X, Y
If StrComp(Left$(D rawStr, 1), "C") = 0 Then
Select Case ds(1)
Case "H"
DrawControl.Lin e (X - ds(2) / 2, Y - ds(3) / 2)-(X + ds(2) / 2, Y + ds(3) / 2), , BF
Case "C"
DrawControl.Fil lStyle = 0
DrawControl.Cir cle (X, Y), ds(2)
DrawControl.Fil lStyle = 1
End Select
Else
Select Case ds(1)
Case "H"
DrawControl.Lin e (X - ds(2) / 2, Y - ds(3) / 2)-(X + ds(2) / 2, Y + ds(3) / 2), , B
End Select
End If
If Main Then
Column_Dis ds(4) + ds(2) / 2, ds(5) - ds(3) / 2, ds(0), DrawControl
End If
ds.Close
dss.Close
'Stop
'DrawDiagonal DrawControl
End Sub[/code]
Comment