Click here to Skip to main content
15,921,622 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionSynchronise day and time Pin
Zakiro5-Sep-05 15:17
Zakiro5-Sep-05 15:17 
AnswerRe: Synchronise day and time Pin
Dave Kreskowiak5-Sep-05 17:42
mveDave Kreskowiak5-Sep-05 17:42 
GeneralRe: Synchronise day and time Pin
Christian Graus5-Sep-05 17:57
protectorChristian Graus5-Sep-05 17:57 
GeneralRe: Synchronise day and time Pin
Dave Kreskowiak6-Sep-05 6:45
mveDave Kreskowiak6-Sep-05 6:45 
QuestionSharing data between Windows forms Pin
roraima5-Sep-05 12:17
roraima5-Sep-05 12:17 
AnswerRe: Sharing data between Windows forms Pin
Christian Graus5-Sep-05 12:18
protectorChristian Graus5-Sep-05 12:18 
GeneralRe: Sharing data between Windows forms Pin
roraima5-Sep-05 12:23
roraima5-Sep-05 12:23 
GeneralRe: Sharing data between Windows forms Pin
Christian Graus5-Sep-05 12:35
protectorChristian Graus5-Sep-05 12:35 
OK - I'll try. I really don't use VB.NET, I kind of think it sucks Smile | :)

Public Class Class1

' A private variable to store the string
Private _path As String
' This is apparently how you add a constructor to VB.NET
Public Sub New(ByVal path As String)
Me._path = path
' You probably don't need to store the string, you could just read the file, and store it's contents.
End Sub

Private Sub New()

End Sub

End Class

That's from a project I just whipped up - the constructor is the method that is called when you create a new object. So when you create a new Class1, in this instance, you need to pass it a string. However, the default constructor ( which takes no arguments and does nothing ) is still available, so I define it to be private ( which means no-one can call it, forcing the one that takes the string to be called ). Once you have the string, you can use it to read the file whenever you like. I am sort of anticipating that question, the link below is to an article on reading text files in VB.NET.

http://www.freevbcode.com/ShowCode.asp?ID=4492[^]

The other way is to have a property, like this:

Public WriteOnly Property Path()
Set(ByVal Value)
_path = Value
' You would also read the text file here, probably
End Set
End Property

Now, you can do myForm.Path = "thepath" before calling the Show method.

Christian Graus - Microsoft MVP - C++
GeneralRe: Sharing data between Windows forms Pin
roraima5-Sep-05 14:14
roraima5-Sep-05 14:14 
AnswerRe: Sharing data between Windows forms Pin
_mubashir6-Sep-05 2:38
_mubashir6-Sep-05 2:38 
AnswerRe: Sharing data between Windows forms Pin
korso_rogan6-Sep-05 9:08
korso_rogan6-Sep-05 9:08 
AnswerRe: Sharing data between Windows forms Pin
eagertolearn8-Sep-05 8:59
eagertolearn8-Sep-05 8:59 
AnswerRe: Sharing data between Windows forms Pin
roraima14-Sep-05 7:24
roraima14-Sep-05 7:24 
QuestionIntelligent Datagrid Pin
| Muhammad Waqas Butt |5-Sep-05 6:05
professional| Muhammad Waqas Butt |5-Sep-05 6:05 
AnswerRe: Intelligent Datagrid Pin
mikone5-Sep-05 10:16
mikone5-Sep-05 10:16 
QuestionOpen default mail client with attachments Pin
marowle5-Sep-05 4:19
marowle5-Sep-05 4:19 
QuestionListview selects? Pin
dave@ennead5-Sep-05 3:26
dave@ennead5-Sep-05 3:26 
AnswerRe: Listview selects? Pin
dave@ennead5-Sep-05 3:35
dave@ennead5-Sep-05 3:35 
QuestionSlow WMI-Query, what reason? Pin
mikone5-Sep-05 3:26
mikone5-Sep-05 3:26 
AnswerRe: Slow WMI-Query, what reason? Pin
progload6-Sep-05 9:41
progload6-Sep-05 9:41 
GeneralRe: Slow WMI-Query, what reason? Pin
mikone7-Sep-05 21:28
mikone7-Sep-05 21:28 
QuestionT-SQL Clause Pin
Greeky5-Sep-05 3:17
Greeky5-Sep-05 3:17 
AnswerRe: T-SQL Clause Pin
maximvs5-Sep-05 7:15
maximvs5-Sep-05 7:15 
QuestionBooks about .NET with examples for learning Pin
hcmuns5-Sep-05 0:59
susshcmuns5-Sep-05 0:59 
AnswerRe: Books about .NET with examples for learning Pin
Christian Graus5-Sep-05 11:29
protectorChristian Graus5-Sep-05 11:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.