I am trying to get somewhere with user controls and have come up against an
obstacle with using relative paths.
I have a dataset in my user control, and have tried to enter the path with
the following:-
dsResultsTable. ReadXml(Applica tion.StartupPat h &
"\Textfiles\Res ultsTable.xml")
It does not like this, as it takes the application path to be C:\Program
Files\Microsoft Visual Studio .NET\Common7\ID E\devenv.exe.
I have also tried to send the path into the user control as a variable,
using a property - it does not like this either, as it is again looking for
the path above as I try and place the control on my page..
Can anyone point me to a possible solution and explain where I am going
wrong. Why cannot I pass the path in as a property??
ResultsPathXML is being sent to the user control as
(Application.St artupPath & "\Textfiles\Res ultsTable.xml") , and I have this
in the Load of my form that is using the control.
Finally are there any good - ? web-based resources to help me with user
controls, using the Usercontrol class, as I think that this will avoid me
doing a lot of repetitive coding in my applications.
Many thanks - Paul Bromley
Public Class ctlSendResultsE MIS
Inherits System.Windows. Forms.UserContr ol
Private sLabFilter As String
Private sLabResult As String
Private sLabCode As String
Private dsResultsTable As New DataSet()
Private dvResultsTable As New Data.DataView()
Private sResultsPath As String '= (Application.St artupPath &
"\Textfiles\Res ultsTable.xml")
Property ResultsPathXML( ) As String
Get ' Retrieves the value of the private variable.
Return sResultsPath
End Get ' Stores the selected value in the private variable txtTrialText
Set(ByVal Value As String)
sResultsPath = Value
End Set
End Property
Later in the code:-
Private Sub ctlSendResultsE MIS_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
dsResultsTable. ReadXml(sResult sPath)
dvResultsTable = dsResultsTable. Tables(0).Defau ltView '.DefaultView
GridResults.Dat aSource = dvResultsTable
End Sub
obstacle with using relative paths.
I have a dataset in my user control, and have tried to enter the path with
the following:-
dsResultsTable. ReadXml(Applica tion.StartupPat h &
"\Textfiles\Res ultsTable.xml")
It does not like this, as it takes the application path to be C:\Program
Files\Microsoft Visual Studio .NET\Common7\ID E\devenv.exe.
I have also tried to send the path into the user control as a variable,
using a property - it does not like this either, as it is again looking for
the path above as I try and place the control on my page..
Can anyone point me to a possible solution and explain where I am going
wrong. Why cannot I pass the path in as a property??
ResultsPathXML is being sent to the user control as
(Application.St artupPath & "\Textfiles\Res ultsTable.xml") , and I have this
in the Load of my form that is using the control.
Finally are there any good - ? web-based resources to help me with user
controls, using the Usercontrol class, as I think that this will avoid me
doing a lot of repetitive coding in my applications.
Many thanks - Paul Bromley
Public Class ctlSendResultsE MIS
Inherits System.Windows. Forms.UserContr ol
Private sLabFilter As String
Private sLabResult As String
Private sLabCode As String
Private dsResultsTable As New DataSet()
Private dvResultsTable As New Data.DataView()
Private sResultsPath As String '= (Application.St artupPath &
"\Textfiles\Res ultsTable.xml")
Property ResultsPathXML( ) As String
Get ' Retrieves the value of the private variable.
Return sResultsPath
End Get ' Stores the selected value in the private variable txtTrialText
Set(ByVal Value As String)
sResultsPath = Value
End Set
End Property
Later in the code:-
Private Sub ctlSendResultsE MIS_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
dsResultsTable. ReadXml(sResult sPath)
dvResultsTable = dsResultsTable. Tables(0).Defau ltView '.DefaultView
GridResults.Dat aSource = dvResultsTable
End Sub
Comment