hey guys i need a bit of help finishing my project,
can someone tell me if its possible to bring for example a bar graph made in word/excel into vb6? I needed to display data in a bar graph so i made it in word since i dont know if its possible to make one in Vb.(if it is please tell me how)
And my second question is that how would i do something like this
__________________________________________________________________
Print the precipitation data (in a neat table with headers and row indicators) to the screen
Hear is my main code if its any help, thanyou.
(and a word doc is attached, if u need more info on what im trying to do.)
Code:
Option Explicit
Function AverageNorth()
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Double
intCol = 1
For intRow = 1 To 6
dblSum = dblSum + dblDataArray(intRow, intCol)
Next intRow
AverageNorth = dblSum / 6
End Function
Function AverageApril()
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Double
intRow = 4
For intCol = 1 To 4
dblSum = dblSum + dblDataArray(intRow, intCol)
Next intCol
AverageApril = dblSum / 4
End Function
Private Sub cmdAnswerH_Click()
frmAnswerH.lblH.Caption = frmAnswerH.lblH.Caption & " " & _
seccondSmallest & "cm"
frmMainMenu.Hide
frmAnswerH.Show
End Sub
Function seccondSmallest()
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Integer
Dim intCount As Integer
dblSum = 1
For intRow = 1 To 6
For intCol = 1 To 4
If (dblDataArray(intRow, intCol)) < dblSum Then
dblSum = dblDataArray(intRow, intCol)
End If
Next intCol
Next intRow
seccondSmallest = dblSum
End Function
Private Sub cmdC_Click()
frmAnswerC.lblC.Caption = frmAnswerC.lblC.Caption & " " & _
AverageNorth & "cm"
frmMainMenu.Hide
frmAnswerC.Show
End Sub
Private Sub cmdD_Click()
frmAnswerD.lblD.Caption = frmAnswerD.lblD.Caption & " " & _
AverageApril & "cm"
frmMainMenu.Hide
frmAnswerD.Show
End Sub
Private Sub cmdDisplay_Click()
frmDisplay.lbl11 = dblDataArray(1, 1)
frmDisplay.lbl12 = dblDataArray(1, 2)
frmDisplay.lbl13 = dblDataArray(1, 4)
frmDisplay.lbl14 = dblDataArray(1, 4)
frmDisplay.lbl21 = dblDataArray(2, 1)
frmDisplay.lbl22 = dblDataArray(2, 2)
frmDisplay.lbl23 = dblDataArray(2, 3)
frmDisplay.lbl24 = dblDataArray(2, 4)
frmDisplay.lbl31 = dblDataArray(3, 1)
frmDisplay.lbl32 = dblDataArray(3, 2)
frmDisplay.lbl33 = dblDataArray(3, 3)
frmDisplay.lbl34 = dblDataArray(3, 4)
frmDisplay.lbl41 = dblDataArray(4, 1)
frmDisplay.lbl42 = dblDataArray(4, 2)
frmDisplay.lbl43 = dblDataArray(4, 3)
frmDisplay.lbl44 = dblDataArray(4, 4)
frmDisplay.lbl51 = dblDataArray(5, 1)
frmDisplay.lbl52 = dblDataArray(5, 2)
frmDisplay.lbl53 = dblDataArray(5, 3)
frmDisplay.lbl54 = dblDataArray(5, 4)
frmDisplay.lbl61 = dblDataArray(6, 1)
frmDisplay.lbl62 = dblDataArray(6, 2)
frmDisplay.lbl63 = dblDataArray(6, 3)
frmDisplay.lbl64 = dblDataArray(6, 4)
frmMainMenu.Hide
frmDisplay.Show
End Sub
Function Average()
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Double
intCol = 1
For intRow = 1 To 6
dblSum = dblSum + dblDataArray(intRow, intCol)
Next intRow
AverageNorth = dblSum / 6
End Function
Function TotalPercipitation()
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Integer
For intRow = 1 To 6
For intCol = 1 To 4
dblSum = dblSum + dblDataArray(intRow, intCol)
Next intCol
Next intRow
TotalPercipitation = dblSum
End Function
Function LargestJune()
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Integer
intRow = 6
For intCol = 1 To 4
If (dblDataArray(intRow, intCol)) > dblSum Then
dblSum = dblDataArray(intRow, intCol)
End If
Next intCol
LargestJune = dblSum
End Function
Private Sub cmdE_Click()
frmAnswerE.lblE.Caption = frmAnswerE.lblE.Caption & " " & _
TotalPercipitation & "cm"
frmMainMenu.Hide
frmAnswerE.Show
End Sub
Private Sub cmdExit_Click()
Unload frmAnswerC
Unload frmDisplay
Unload Me
End Sub
Private Sub cmdF_Click()
frmAnswerF.lblF.Caption = frmAnswerF.lblF.Caption & " " & _
LargestJune & "cm"
frmMainMenu.Hide
frmAnswerF.Show
End Sub
Function SmallestSouth()
Dim intFIleNum As Integer
Dim strData As String
Dim intRow As Integer
Dim intCol As Integer
Dim dblSum As Double
intCol = 3
dblSum = 100
For intRow = 1 To 6
If (dblDataArray(intRow, intCol)) < dblSum Then
dblSum = dblDataArray(intRow, intCol)
End If
Next intRow
SmallestSouth = dblSum
End Function
Private Sub cmdG_Click()
frmAnswerG.lblG.Caption = frmAnswerG.lblG.Caption & " " & _
SmallestSouth & "cm"
frmMainMenu.Hide
frmAnswerG.Show
End Sub
Private Sub cmdLoad_Click()
Dim intFIleNum As Integer
Dim strData As String
Dim intRow As Integer
Dim intCol As Integer
intFIleNum = FreeFile
Open (App.Path & "\" & "Precip.txt") For Input As #intFIleNum 'Open Assigns it to intfileenum
For intRow = 1 To 6
For intCol = 1 To 4
Input #intFIleNum, strData 'store
dblDataArray(intRow, intCol) = Val(strData)
Next intCol
Next intRow
Close #intFIleNum
End Sub
Private Sub cmdWrite_Click()
Dim index
Dim intFIleNum As Integer
Dim intRow As Integer
Dim intCol As Integer
intFIleNum = FreeFile
Open (App.Path & "\" & " precipe2.txt") For Output As #intFIleNum
For intRow = 1 To 6
For intCol = 1 To 4
Print #intFIleNum, dblDataArray(intRow, intCol)
Next intCol
Next intRow
Close #intFIleNum
End Sub
Last edited by cruisx; Dec 19th, 2007 at 07:53 PM.