23-08-13, 03:33 AM
اخواني ارجو مساعدتي في الفلكس جريد بحيث اذا تم الظغط على انتر يذهب المؤشر الى خلية رقم 4 (الكمية)
ارفقة المثال ليتم التعديل عليه
[ATTACH]3863[/ATTACH]
ارفقة المثال ليتم التعديل عليه
[ATTACH]3863[/ATTACH]
Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
MSFlexGrid1.Col = 4
MSFlexGrid1.SetFocus
End If
End SubPrivate Sub Command1_Click()
Dim MaxLen() As Integer
Dim I As Long
Dim N, F As Integer
Dim CurrentLine As String
ReDim MaxLen(MSFlexGrid1.Cols - 1) As Integer
For I = 0 To MSFlexGrid1.Rows - 1
For N = 0 To MSFlexGrid1.Cols - 1
If Len(Trim(MSFlexGrid1.TextMatrix(I, N))) > MaxLen(N) Then
MaxLen(N) = Len(Trim(MSFlexGrid1.TextMatrix(I, N)))
End If
Next
Next
If Dir$(App.Path & "\MSFlexGrid1.Txt") <> "" Then
DeleteFile App.Path & "\MSFlexGrid1.Txt"
DoEvents
End If
F = FreeFile
Open App.Path & "\MSFlexGrid1.Txt" For Append As #F
For I = 0 To MSFlexGrid1.Rows - 1
CurrentLine = ""
For N = 0 To MSFlexGrid1.Cols - 1
If Len(Trim(MSFlexGrid1.TextMatrix(I, N))) < MaxLen(N) Then
CurrentLine = CurrentLine & Trim(MSFlexGrid1.TextMatrix(I, N)) & Space(MaxLen(N) - Len(Trim(MSFlexGrid1.TextMatrix(I, N)))) & Space(5)
Else
CurrentLine = CurrentLine & Trim(MSFlexGrid1.TextMatrix(I, N)) & Space(5)
End If
Next
Print #F, CurrentLine
DoEvents
Next
Close #F
DoEvents
MsgBox "تم التصدير بنجاح", vbOKOnly + vbInformation, "تنبيه"
End Sub