View Single Post
  #2 (permalink)  
Old 06-30-2009, 3:03 PM
newguy's Avatar
newguy newguy is offline
VB.NET Forum Idol
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2008
Location: Denver Co, USA
Posts: 545
Reputation: 128
newguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET star
Default

Sure, make a Sub New with parameters in the UC's code:
Code:
Private m_FileName As String
Public Sub New(ByVal fileName As String)
   InitializeComponent()
   m_FileName = filename
End Sub
Then when you create the UC it will look like this:
Code:
Dim uc As New UserControl1("C:\test.txt")
Or you can just have the m_FileName set to Public and call it when creating it:
Code:
Dim uc As New UserControl1
uc.m_FileName = "C:\test.txt"
__________________
Close Counts for Horseshoes, Handgranades, and Nuclear Missiles!

Last edited by newguy; 06-30-2009 at 3:17 PM.
Reply With Quote