What I am trying to do is to have a function that reads data from a file and use that data to set the text of labels which are on Form1.Quoted
(This is in form1)
Public Sub Form_Load()
label1 = setlabel
End Sub
(This is in Module1)
Public Function Setlabel() As String
Setlabel = "Label set"
End Function
This post has been edited 2 times, last edit by "indyglassman" (May 12th 2014, 3:28am)
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
Option Explicit Public Sub Form_Load() Label1.Caption = SetLabel() End Sub Public Function SetLabel() As String Dim fh As VBFileHandler Set fh = FileSystem.Open("c:\test.txt") SetLabel = fh.readAll() fh.close End Function |
This post has been edited 1 times, last edit by "Dani" (May 12th 2014, 8:22am)
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
'Public Form1 As New Form1 Public Sub main(ByJava args() As String) Dim Form1 As New Form1 Dim myArgs() As String myArgs = args Form1.SetDefaultClose() Form1.Show() End Sub Public Function SetLabel() As String Dim fh As VBFileHandler Set fh = FileSystem.Open("c:\test.txt") SetLabel = fh.readAll() fh.close End Function |
Quoted
In your second suggestion I don't see where you suggest I call Setlabel() from.
Jabaco Source |
|
1 2 3 |
Public Sub Form_Load() Label1.Caption = SetLabel() End Sub |
Quoted
This is exactly what I'm trying to do ...
Source code |
|
1 2 3 |
Public Sub Form_Load() SetLabel() End Sub |
Quoted
Public Form1 As New Form1
Public Sub main(ByJava args() As String)
Dim myArgs() As String
myArgs = args
Form1.SetDefaultClose()
Form1.Show()
End Sub
Public Function SetLabel() As String
SetLabel = "MyLabel"
End Function
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
'Public Form1 As New Form1 Public Sub main(ByJava args() As String) Dim Form1 As New Form1 Dim myArgs() As String myArgs = args Form1.SetDefaultClose() Form1.Show() End Sub Public Function SetLabel() As String Dim fh As VBFileHandler Set fh = FileSystem.Open("c:\test.txt") SetLabel = fh.readAll() fh.close End Function |
Jabaco Source |
|
1 2 3 |
Public Sub Form_Load() SetLabel() End Sub |
Source code |
|
1 2 3 |
Public Sub Form_Load() SetLabel() End Sub |
Quoted
This does nothing because the SetLabel() is a function that returns a value. But the code doesn't tell it where to put that value
Quoted
So, now this works with the change you suggested. You mentioned you don't know the effects. Do you think this may cause issues for me?