Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > Component Development

Component Development Development of components with VB.NET

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2009, 6:07 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2009
Posts: 4
Reputation: 0
anand.neeli is on a distinguished programming path ahead
Default adaptive user control

Hi Experts,

i have a user control which opens a file and renders data in some specific format.
is there a way to make sure that each instance of user control operate on different file (which can be obtained from mail form)

To tell shortly, how can user control be loaded with some paramaters/data from main form?

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-30-2009, 3:03 PM
newguy's Avatar
VB.NET Forum Idol
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2008
Location: Denver Co, USA
Posts: 547
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-27-2009, 2:12 PM
VB.NET Forum Enthusiast
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jul 2009
Location: UK
Posts: 57
Reputation: 11
henryminute is on a distinguished programming path ahead
Default

I don't want to seem picky, but.
Fields should never be made public. The OP should create a Public Property for access to the m_Filename Field.
__________________
Some create happiness wherever they go, others whenever - Oscar Wilde
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 11:44 PM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.