User controls and relative paths | | |
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(Application.StartupPath &
"\Textfiles\ResultsTable.xml")
It does not like this, as it takes the application path to be C:\Program
Files\Microsoft Visual Studio .NET\Common7\IDE\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.StartupPath & "\Textfiles\ResultsTable.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 ctlSendResultsEMIS
Inherits System.Windows.Forms.UserControl
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.StartupPath &
"\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dsResultsTable.ReadXml(sResultsPath)
dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
GridResults.DataSource = dvResultsTable
End Sub | | | | re: User controls and relative paths
I tried you code and it worked. Would it be possible for you to post
more code?
Paul Bromley wrote:[color=blue]
> 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(Application.StartupPath &
> "\Textfiles\ResultsTable.xml")
>
> It does not like this, as it takes the application path to be C:\Program
> Files\Microsoft Visual Studio .NET\Common7\IDE\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.StartupPath & "\Textfiles\ResultsTable.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 ctlSendResultsEMIS
> Inherits System.Windows.Forms.UserControl
> 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.StartupPath &
> "\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> dsResultsTable.ReadXml(sResultsPath)
> dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
> GridResults.DataSource = dvResultsTable
> End Sub
>
>
>[/color] | | | | re: User controls and relative paths
I tried you code and it worked. Would it be possible for you to post
more code?
Paul Bromley wrote:[color=blue]
> 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(Application.StartupPath &
> "\Textfiles\ResultsTable.xml")
>
> It does not like this, as it takes the application path to be C:\Program
> Files\Microsoft Visual Studio .NET\Common7\IDE\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.StartupPath & "\Textfiles\ResultsTable.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 ctlSendResultsEMIS
> Inherits System.Windows.Forms.UserControl
> 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.StartupPath &
> "\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> dsResultsTable.ReadXml(sResultsPath)
> dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
> GridResults.DataSource = dvResultsTable
> End Sub
>
>
>[/color] | | | | re: User controls and relative paths
Hi,
There is not a great deal more to the code. I have few textboxes and
command buttons on the user control and a grid control. The grid is
populated from the dataset. I then use a command button and the contents of
the textbox to filter the grid. I am presntly using VS.NET 2002 - not sure
if that is where the problem lies. As soon as I try to place the user
control on a form, I get the error re the path.
Many thanks
Paul Bromley
"yEaH rIgHt" <nothanks@haha.com> wrote in message
news:10760q14kjbofda@corp.supernews.com...[color=blue]
> I tried you code and it worked. Would it be possible for you to post
> more code?
>
>
>
> Paul Bromley wrote:[color=green]
> > I am trying to get somewhere with user controls and have come up against[/color][/color]
an[color=blue][color=green]
> > obstacle with using relative paths.
> >
> > I have a dataset in my user control, and have tried to enter the path[/color][/color]
with[color=blue][color=green]
> > the following:-
> >
> > dsResultsTable.ReadXml(Application.StartupPath &
> > "\Textfiles\ResultsTable.xml")
> >
> > It does not like this, as it takes the application path to be C:\Program
> > Files\Microsoft Visual Studio .NET\Common7\IDE\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[/color][/color]
for[color=blue][color=green]
> > 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.StartupPath & "\Textfiles\ResultsTable.xml"), and I have[/color][/color]
this[color=blue][color=green]
> > 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[/color][/color]
me[color=blue][color=green]
> > doing a lot of repetitive coding in my applications.
> >
> > Many thanks - Paul Bromley
> >
> > Public Class ctlSendResultsEMIS
> > Inherits System.Windows.Forms.UserControl
> > 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.StartupPath &
> > "\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > dsResultsTable.ReadXml(sResultsPath)
> > dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
> > GridResults.DataSource = dvResultsTable
> > End Sub
> >
> >
> >[/color][/color] | | | | re: User controls and relative paths
Hi,
There is not a great deal more to the code. I have few textboxes and
command buttons on the user control and a grid control. The grid is
populated from the dataset. I then use a command button and the contents of
the textbox to filter the grid. I am presntly using VS.NET 2002 - not sure
if that is where the problem lies. As soon as I try to place the user
control on a form, I get the error re the path.
Many thanks
Paul Bromley
"yEaH rIgHt" <nothanks@haha.com> wrote in message
news:10760q14kjbofda@corp.supernews.com...[color=blue]
> I tried you code and it worked. Would it be possible for you to post
> more code?
>
>
>
> Paul Bromley wrote:[color=green]
> > I am trying to get somewhere with user controls and have come up against[/color][/color]
an[color=blue][color=green]
> > obstacle with using relative paths.
> >
> > I have a dataset in my user control, and have tried to enter the path[/color][/color]
with[color=blue][color=green]
> > the following:-
> >
> > dsResultsTable.ReadXml(Application.StartupPath &
> > "\Textfiles\ResultsTable.xml")
> >
> > It does not like this, as it takes the application path to be C:\Program
> > Files\Microsoft Visual Studio .NET\Common7\IDE\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[/color][/color]
for[color=blue][color=green]
> > 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.StartupPath & "\Textfiles\ResultsTable.xml"), and I have[/color][/color]
this[color=blue][color=green]
> > 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[/color][/color]
me[color=blue][color=green]
> > doing a lot of repetitive coding in my applications.
> >
> > Many thanks - Paul Bromley
> >
> > Public Class ctlSendResultsEMIS
> > Inherits System.Windows.Forms.UserControl
> > 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.StartupPath &
> > "\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > dsResultsTable.ReadXml(sResultsPath)
> > dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
> > GridResults.DataSource = dvResultsTable
> > End Sub
> >
> >
> >[/color][/color] | | | | re: User controls and relative paths
Try this, it might help.
Right click on the Project Solution and select Properties. Open the
Common Properties folder then select Debug Source Files. If devenv.exe
is listed in the box, delete it.
Paul Bromley wrote:[color=blue]
> Hi,
>
> There is not a great deal more to the code. I have few textboxes and
> command buttons on the user control and a grid control. The grid is
> populated from the dataset. I then use a command button and the contents of
> the textbox to filter the grid. I am presntly using VS.NET 2002 - not sure
> if that is where the problem lies. As soon as I try to place the user
> control on a form, I get the error re the path.
>
> Many thanks
>
> Paul Bromley
>
>
> "yEaH rIgHt" <nothanks@haha.com> wrote in message
> news:10760q14kjbofda@corp.supernews.com...
>[color=green]
>>I tried you code and it worked. Would it be possible for you to post
>>more code?
>>
>>
>>
>>Paul Bromley wrote:
>>[color=darkred]
>>>I am trying to get somewhere with user controls and have come up against[/color][/color]
>
> an
>[color=green][color=darkred]
>>>obstacle with using relative paths.
>>>
>>> I have a dataset in my user control, and have tried to enter the path[/color][/color]
>
> with
>[color=green][color=darkred]
>>>the following:-
>>>
>>>dsResultsTable.ReadXml(Application.StartupPat h &
>>>"\Textfiles\ResultsTable.xml")
>>>
>>>It does not like this, as it takes the application path to be C:\Program
>>>Files\Microsoft Visual Studio .NET\Common7\IDE\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[/color][/color]
>
> for
>[color=green][color=darkred]
>>>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.StartupPath & "\Textfiles\ResultsTable.xml"), and I have[/color][/color]
>
> this
>[color=green][color=darkred]
>>>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[/color][/color]
>
> me
>[color=green][color=darkred]
>>>doing a lot of repetitive coding in my applications.
>>>
>>>Many thanks - Paul Bromley
>>>
>>>Public Class ctlSendResultsEMIS
>>>Inherits System.Windows.Forms.UserControl
>>>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.StartupPath &
>>>"\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
>>>System.EventArgs) Handles MyBase.Load
>>>dsResultsTable.ReadXml(sResultsPath)
>>>dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
>>>GridResults.DataSource = dvResultsTable
>>>End Sub
>>>
>>>
>>>[/color][/color]
>
>
>[/color] | | | | re: User controls and relative paths
Try this, it might help.
Right click on the Project Solution and select Properties. Open the
Common Properties folder then select Debug Source Files. If devenv.exe
is listed in the box, delete it.
Paul Bromley wrote:[color=blue]
> Hi,
>
> There is not a great deal more to the code. I have few textboxes and
> command buttons on the user control and a grid control. The grid is
> populated from the dataset. I then use a command button and the contents of
> the textbox to filter the grid. I am presntly using VS.NET 2002 - not sure
> if that is where the problem lies. As soon as I try to place the user
> control on a form, I get the error re the path.
>
> Many thanks
>
> Paul Bromley
>
>
> "yEaH rIgHt" <nothanks@haha.com> wrote in message
> news:10760q14kjbofda@corp.supernews.com...
>[color=green]
>>I tried you code and it worked. Would it be possible for you to post
>>more code?
>>
>>
>>
>>Paul Bromley wrote:
>>[color=darkred]
>>>I am trying to get somewhere with user controls and have come up against[/color][/color]
>
> an
>[color=green][color=darkred]
>>>obstacle with using relative paths.
>>>
>>> I have a dataset in my user control, and have tried to enter the path[/color][/color]
>
> with
>[color=green][color=darkred]
>>>the following:-
>>>
>>>dsResultsTable.ReadXml(Application.StartupPat h &
>>>"\Textfiles\ResultsTable.xml")
>>>
>>>It does not like this, as it takes the application path to be C:\Program
>>>Files\Microsoft Visual Studio .NET\Common7\IDE\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[/color][/color]
>
> for
>[color=green][color=darkred]
>>>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.StartupPath & "\Textfiles\ResultsTable.xml"), and I have[/color][/color]
>
> this
>[color=green][color=darkred]
>>>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[/color][/color]
>
> me
>[color=green][color=darkred]
>>>doing a lot of repetitive coding in my applications.
>>>
>>>Many thanks - Paul Bromley
>>>
>>>Public Class ctlSendResultsEMIS
>>>Inherits System.Windows.Forms.UserControl
>>>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.StartupPath &
>>>"\Textfiles\ResultsTable.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 ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
>>>System.EventArgs) Handles MyBase.Load
>>>dsResultsTable.ReadXml(sResultsPath)
>>>dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
>>>GridResults.DataSource = dvResultsTable
>>>End Sub
>>>
>>>
>>>[/color][/color]
>
>
>[/color] | | | | re: User controls and relative paths
Thanks for the input - unfortunately it did not help. I found that I needed
to delete ALL references to the path, and then to place the control in my
project. I then amend the paths and rebuild the control and then things work
OK. I assume that this may well be abug in VB.Net 2002. I have justs
subscribed to MSDN Professional and so when I get home I will see if
upgrading to 2003 resolves the matter. Many thanks - thought that this may
help others in the same situtaion and save them some time.
Paul Bromley
"yEaH rIgHt" <nothanks@haha.com> wrote in message
news:1078m0c389f8lfb@corp.supernews.com...[color=blue]
> Try this, it might help.
>
> Right click on the Project Solution and select Properties. Open the
> Common Properties folder then select Debug Source Files. If devenv.exe
> is listed in the box, delete it.
>
> Paul Bromley wrote:[color=green]
> > Hi,
> >
> > There is not a great deal more to the code. I have few textboxes and
> > command buttons on the user control and a grid control. The grid is
> > populated from the dataset. I then use a command button and the contents[/color][/color]
of[color=blue][color=green]
> > the textbox to filter the grid. I am presntly using VS.NET 2002 - not[/color][/color]
sure[color=blue][color=green]
> > if that is where the problem lies. As soon as I try to place the user
> > control on a form, I get the error re the path.
> >
> > Many thanks
> >
> > Paul Bromley
> >
> >
> > "yEaH rIgHt" <nothanks@haha.com> wrote in message
> > news:10760q14kjbofda@corp.supernews.com...
> >[color=darkred]
> >>I tried you code and it worked. Would it be possible for you to post
> >>more code?
> >>
> >>
> >>
> >>Paul Bromley wrote:
> >>
> >>>I am trying to get somewhere with user controls and have come up[/color][/color][/color]
against[color=blue][color=green]
> >
> > an
> >[color=darkred]
> >>>obstacle with using relative paths.
> >>>
> >>> I have a dataset in my user control, and have tried to enter the path[/color]
> >
> > with
> >[color=darkred]
> >>>the following:-
> >>>
> >>>dsResultsTable.ReadXml(Application.StartupPat h &
> >>>"\Textfiles\ResultsTable.xml")
> >>>
> >>>It does not like this, as it takes the application path to be[/color][/color][/color]
C:\Program[color=blue][color=green][color=darkred]
> >>>Files\Microsoft Visual Studio .NET\Common7\IDE\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[/color]
> >
> > for
> >[color=darkred]
> >>>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.StartupPath & "\Textfiles\ResultsTable.xml"), and I have[/color]
> >
> > this
> >[color=darkred]
> >>>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[/color]
> >
> > me
> >[color=darkred]
> >>>doing a lot of repetitive coding in my applications.
> >>>
> >>>Many thanks - Paul Bromley
> >>>
> >>>Public Class ctlSendResultsEMIS
> >>>Inherits System.Windows.Forms.UserControl
> >>>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.StartupPath &
> >>>"\Textfiles\ResultsTable.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[/color][/color][/color]
txtTrialText[color=blue][color=green][color=darkred]
> >>>Set(ByVal Value As String)
> >>>sResultsPath = Value
> >>>End Set
> >>>End Property
> >>>
> >>>
> >>>Later in the code:-
> >>>
> >>>Private Sub ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
> >>>System.EventArgs) Handles MyBase.Load
> >>>dsResultsTable.ReadXml(sResultsPath)
> >>>dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
> >>>GridResults.DataSource = dvResultsTable
> >>>End Sub
> >>>
> >>>
> >>>[/color]
> >
> >
> >[/color][/color] | | | | re: User controls and relative paths
Thanks for the input - unfortunately it did not help. I found that I needed
to delete ALL references to the path, and then to place the control in my
project. I then amend the paths and rebuild the control and then things work
OK. I assume that this may well be abug in VB.Net 2002. I have justs
subscribed to MSDN Professional and so when I get home I will see if
upgrading to 2003 resolves the matter. Many thanks - thought that this may
help others in the same situtaion and save them some time.
Paul Bromley
"yEaH rIgHt" <nothanks@haha.com> wrote in message
news:1078m0c389f8lfb@corp.supernews.com...[color=blue]
> Try this, it might help.
>
> Right click on the Project Solution and select Properties. Open the
> Common Properties folder then select Debug Source Files. If devenv.exe
> is listed in the box, delete it.
>
> Paul Bromley wrote:[color=green]
> > Hi,
> >
> > There is not a great deal more to the code. I have few textboxes and
> > command buttons on the user control and a grid control. The grid is
> > populated from the dataset. I then use a command button and the contents[/color][/color]
of[color=blue][color=green]
> > the textbox to filter the grid. I am presntly using VS.NET 2002 - not[/color][/color]
sure[color=blue][color=green]
> > if that is where the problem lies. As soon as I try to place the user
> > control on a form, I get the error re the path.
> >
> > Many thanks
> >
> > Paul Bromley
> >
> >
> > "yEaH rIgHt" <nothanks@haha.com> wrote in message
> > news:10760q14kjbofda@corp.supernews.com...
> >[color=darkred]
> >>I tried you code and it worked. Would it be possible for you to post
> >>more code?
> >>
> >>
> >>
> >>Paul Bromley wrote:
> >>
> >>>I am trying to get somewhere with user controls and have come up[/color][/color][/color]
against[color=blue][color=green]
> >
> > an
> >[color=darkred]
> >>>obstacle with using relative paths.
> >>>
> >>> I have a dataset in my user control, and have tried to enter the path[/color]
> >
> > with
> >[color=darkred]
> >>>the following:-
> >>>
> >>>dsResultsTable.ReadXml(Application.StartupPat h &
> >>>"\Textfiles\ResultsTable.xml")
> >>>
> >>>It does not like this, as it takes the application path to be[/color][/color][/color]
C:\Program[color=blue][color=green][color=darkred]
> >>>Files\Microsoft Visual Studio .NET\Common7\IDE\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[/color]
> >
> > for
> >[color=darkred]
> >>>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.StartupPath & "\Textfiles\ResultsTable.xml"), and I have[/color]
> >
> > this
> >[color=darkred]
> >>>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[/color]
> >
> > me
> >[color=darkred]
> >>>doing a lot of repetitive coding in my applications.
> >>>
> >>>Many thanks - Paul Bromley
> >>>
> >>>Public Class ctlSendResultsEMIS
> >>>Inherits System.Windows.Forms.UserControl
> >>>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.StartupPath &
> >>>"\Textfiles\ResultsTable.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[/color][/color][/color]
txtTrialText[color=blue][color=green][color=darkred]
> >>>Set(ByVal Value As String)
> >>>sResultsPath = Value
> >>>End Set
> >>>End Property
> >>>
> >>>
> >>>Later in the code:-
> >>>
> >>>Private Sub ctlSendResultsEMIS_Load(ByVal sender As Object, ByVal e As
> >>>System.EventArgs) Handles MyBase.Load
> >>>dsResultsTable.ReadXml(sResultsPath)
> >>>dvResultsTable = dsResultsTable.Tables(0).DefaultView '.DefaultView
> >>>GridResults.DataSource = dvResultsTable
> >>>End Sub
> >>>
> >>>
> >>>[/color]
> >
> >
> >[/color][/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|