Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,435 members, 7,781,271 topics. Date: Friday, 29 March 2024 at 11:32 AM

Vb Concepts - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Vb Concepts (1145 Views)

How To Send SMS Using Asp.net/vb.net / Fingerprint Authentication In Vb.net Application / Post Ur Vb 6.0 Questions Here (2) (3) (4)

(1) (Reply)

Vb Concepts by ebusoft(m): 9:16am On Sep 24, 2008
please some should help me with the following
1. how to print the whole code in different forms in a visual basic project
2. how to show the data in a data base in a grid or as a report. iam using access as my database software in programing with vb thanks
Re: Vb Concepts by luckyCO(m): 11:30am On Sep 24, 2008
ebusoft:

please some should help me with the following
1. how to print the whole code in different forms in a visual basic project
2. how to show the data in a data base in a grid or as a report. iam using access as my database software in programing with vb thanks

I would love you post your problems about VB6.0 in the ongoing thread (Post Ur VB Problem here> to enable me attend to them in one thread.

1. I have not come across a code to print the entire form within a project. You may tell me what you want to achieve with that I may give you a way out.

2. Call FillGrid(<MSH Grid Name>,<Your Connection String>,<SQL Statement>wink
You may change other optional values and see what they can give you.



' Function To Call

Public sub FillGrid(MSH1 As MSHFlexGrid, DbPath As String, SQLstr As String, Optional txtHoldNum As String, Optional SumIt As Boolean, Optional DontDo As Integer, Optional DontDo1 As Integer, Optional FormatWithSense As Boolean, Optional GenSerialOnFirstRow As Boolean, Optional RowPosition As Integer, Optional SummaryXter As String, Optional ColOnly As Integer)
On Error GoTo errh
Dim StoreVA(122) As Single, LP As Integer, HP1 As String

Dim J As Long, I As Integer, db As New ADODB.Recordset
Dim rs As New ADODB.Connection
rs.ConnectionString = DbPath
rs.Open
Set db = rs.Execute(SQLstr)

MSH1.Refresh
Cancel_Grid_Fill = False


MSH1.Rows = 2

MSH1.Cols = db.Fields.Count
For J = 0 To db.Fields.Count - 1
MSH1.TextMatrix(0, J) = db.Fields(J).Name
MSH1.TextMatrix(1, J) = ""
Next J

J = 0

Do While Not db.EOF
J = J + 1
MSH1.Rows = J + 1


For I = 0 To db.Fields.Count - 1
MSH1.TextMatrix(J, I) = ""

If IsNull(db.Fields(I).Value) = False Then

If Val(txtHoldNum) > 10 And SumIt = True And db.Fields(I).Type < 120 Then
If ColOnly = 0 Then
StoreVA(I) = Val(db.Fields(I).Value) + StoreVA(I)
ElseIf ColOnly = I Then
StoreVA(I) = Val(db.Fields(I).Value) + StoreVA(I)
End If

If I <> DontDo And I <> DontDo1 And FormatWithSense = True Then
MSH1.TextMatrix(J, I) = " " & Format(db.Fields(I).Value, "0,000.00"wink
Else
MSH1.TextMatrix(J, I) = " " & db.Fields(I).Value
End If

ElseIf db.Fields(I).Type < 120 And (I = DontDo Or I = DontDo1) Then
HP1 = db.Fields(I).Value

If FormatWithSense = True Then
If Val(HP1) - Int(Val(HP1)) = 0 Then
HP1 = Format(HP1, "0,0"wink
Else
HP1 = Format(HP1, "0,0.00"wink
End If
End If

MSH1.TextMatrix(J, I) = " " & HP1
Else
MSH1.TextMatrix(J, I) = " " & db.Fields(I).Value
End If

End If

If GenSerialOnFirstRow = True And I = RowPosition Then
MSH1.TextMatrix(J, I) = J
End If


Next I
db.MoveNext

DoEvents
If Cancel_Grid_Fill = True Then
If MsgBox("Are you sure you want to cancel this process", vbQuestion + vbYesNo, "Choose either yes or no"wink = vbNo Then: Cancel_Grid_Fill = False: Exit sub
Exit sub
End If

'If CancelNexted = True Then CancelNexted = False: Exit Sub


Loop


db.Close
rs.Close


If Val(txtHoldNum) > 10 Then
MSH1.Rows = MSH1.Rows + 1
MSH1.Rows = MSH1.Rows + 1

For I = 0 To MSH1.Cols - 1

If DontDo = I And I <> DontDo1 Then
MSH1.TextMatrix(MSH1.Rows - 1, I) = StoreVA(I)
Else

If FormatWithSense = True Then
MSH1.TextMatrix(MSH1.Rows - 1, I) = IIf(StoreVA(I) <> 0, Format(StoreVA(I), "0,000.00"wink, ""wink
Else
MSH1.TextMatrix(MSH1.Rows - 1, I) = " " & IIf(StoreVA(I) <> 0, Format(StoreVA(I), "0,0"wink, ""wink
End If

End If

Next I
If SummaryXter = "" Then
MSH1.TextMatrix(MSH1.Rows - 1, 1) = "Summary:"
Else
MSH1.TextMatrix(MSH1.Rows - 1, 1) = SummaryXter
End If

End If

Exit Sub

errh:
End Sub

Check whether it helps.
On reply for this please come over to Post ur Vb Problems here forum for me to give you adequate attention

(1) (Reply)

Simple Banned Word Algorithm. / Programmers Come To My Aid Please. / Between Those In %ah Soma Living Demonstrate A Sample Putting Is

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.