vahidjahanbin
دوشنبه 21 آذر 1390, 10:56 صبح
Public Function PassCode(Pass As String) As String
Dim newpas As String
newpas = ""
For i = 1 To Len(Pass)
If Len(Chr$(Asc(Mid(Pass, i, 1)))) = 3 Then
newpas = newpas & Asc(Mid(Pass, i, 1))
Else
newpas = newpas & "0" & Asc(Mid(Pass, i, 1))
End If
Next i
PassCode = newpas
End Function
Public Sub SetGridColumnWidth(grd As MSHFlexGrid)
Dim InnerLoopCount As Long
Dim OuterLoopCount As Long
Dim lngLongestLen As Long
Dim sLongestString As String
Dim lngColWidth As Long
Dim szCellText As String
With grd
For OuterLoopCount = 0 To .Cols - 1
sLongestString = ""
lngLongestLen = 0
For InnerLoopCount = 0 To .Rows - 1
szCellText = .TextMatrix(InnerLoopCount, OuterLoopCount)
If Len(szCellText) > lngLongestLen Then
lngLongestLen = Len(szCellText)
sLongestString = szCellText
End If
Next
lngColWidth = .Parent.TextWidth(sLongestString)
.ColWidth(OuterLoopCount) = lngColWidth + 300
Next
End With
End Sub
Dim newpas As String
newpas = ""
For i = 1 To Len(Pass)
If Len(Chr$(Asc(Mid(Pass, i, 1)))) = 3 Then
newpas = newpas & Asc(Mid(Pass, i, 1))
Else
newpas = newpas & "0" & Asc(Mid(Pass, i, 1))
End If
Next i
PassCode = newpas
End Function
Public Sub SetGridColumnWidth(grd As MSHFlexGrid)
Dim InnerLoopCount As Long
Dim OuterLoopCount As Long
Dim lngLongestLen As Long
Dim sLongestString As String
Dim lngColWidth As Long
Dim szCellText As String
With grd
For OuterLoopCount = 0 To .Cols - 1
sLongestString = ""
lngLongestLen = 0
For InnerLoopCount = 0 To .Rows - 1
szCellText = .TextMatrix(InnerLoopCount, OuterLoopCount)
If Len(szCellText) > lngLongestLen Then
lngLongestLen = Len(szCellText)
sLongestString = szCellText
End If
Next
lngColWidth = .Parent.TextWidth(sLongestString)
.ColWidth(OuterLoopCount) = lngColWidth + 300
Next
End With
End Sub