User controls and relative paths

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Bromley

    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(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



  • yEaH rIgHt

    #2
    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(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
    >
    >
    >[/color]

    Comment

    • yEaH rIgHt

      #3
      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(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
      >
      >
      >[/color]

      Comment

      • Paul Bromley

        #4
        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:10760q14kj bofda@corp.supe rnews.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(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[/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.St artupPath & "\Textfiles\Res ultsTable.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 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
        > >
        > >
        > >[/color][/color]


        Comment

        • Paul Bromley

          #5
          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:10760q14kj bofda@corp.supe rnews.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(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[/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.St artupPath & "\Textfiles\Res ultsTable.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 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
          > >
          > >
          > >[/color][/color]


          Comment

          • yEaH rIgHt

            #6
            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:10760q14kj bofda@corp.supe rnews.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:-
            >>>
            >>>dsResultsTab le.ReadXml(Appl ication.Startup Path &
            >>>"\Textfiles\ ResultsTable.xm l")
            >>>
            >>>It does not like this, as it takes the application path to be C:\Program
            >>>Files\Micros oft 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[/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??
            >>>
            >>>ResultsPathX ML is being sent to the user control as
            >>>(Application .StartupPath & "\Textfiles\Res ultsTable.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 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\ ResultsTable.xm l")
            >>>
            >>>
            >>>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)
            >>>sResultsPa th = Value
            >>>End Set
            >>>End Property
            >>>
            >>>
            >>>Later in the code:-
            >>>
            >>>Private Sub ctlSendResultsE MIS_Load(ByVal sender As Object, ByVal e As
            >>>System.Event Args) Handles MyBase.Load
            >>>dsResultsTab le.ReadXml(sRes ultsPath)
            >>>dvResultsTab le = dsResultsTable. Tables(0).Defau ltView '.DefaultView
            >>>GridResults. DataSource = dvResultsTable
            >>>End Sub
            >>>
            >>>
            >>>[/color][/color]
            >
            >
            >[/color]

            Comment

            • yEaH rIgHt

              #7
              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:10760q14kj bofda@corp.supe rnews.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:-
              >>>
              >>>dsResultsTab le.ReadXml(Appl ication.Startup Path &
              >>>"\Textfiles\ ResultsTable.xm l")
              >>>
              >>>It does not like this, as it takes the application path to be C:\Program
              >>>Files\Micros oft 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[/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??
              >>>
              >>>ResultsPathX ML is being sent to the user control as
              >>>(Application .StartupPath & "\Textfiles\Res ultsTable.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 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\ ResultsTable.xm l")
              >>>
              >>>
              >>>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)
              >>>sResultsPa th = Value
              >>>End Set
              >>>End Property
              >>>
              >>>
              >>>Later in the code:-
              >>>
              >>>Private Sub ctlSendResultsE MIS_Load(ByVal sender As Object, ByVal e As
              >>>System.Event Args) Handles MyBase.Load
              >>>dsResultsTab le.ReadXml(sRes ultsPath)
              >>>dvResultsTab le = dsResultsTable. Tables(0).Defau ltView '.DefaultView
              >>>GridResults. DataSource = dvResultsTable
              >>>End Sub
              >>>
              >>>
              >>>[/color][/color]
              >
              >
              >[/color]

              Comment

              • Paul Bromley

                #8
                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:1078m0c389 f8lfb@corp.supe rnews.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:10760q14kj bofda@corp.supe rnews.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:-
                > >>>
                > >>>dsResultsTab le.ReadXml(Appl ication.Startup Path &
                > >>>"\Textfiles\ ResultsTable.xm l")
                > >>>
                > >>>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\Micros oft 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[/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??
                > >>>
                > >>>ResultsPathX ML is being sent to the user control as
                > >>>(Application .StartupPath & "\Textfiles\Res ultsTable.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 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\ ResultsTable.xm l")
                > >>>
                > >>>
                > >>>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)
                > >>>sResultsPa th = Value
                > >>>End Set
                > >>>End Property
                > >>>
                > >>>
                > >>>Later in the code:-
                > >>>
                > >>>Private Sub ctlSendResultsE MIS_Load(ByVal sender As Object, ByVal e As
                > >>>System.Event Args) Handles MyBase.Load
                > >>>dsResultsTab le.ReadXml(sRes ultsPath)
                > >>>dvResultsTab le = dsResultsTable. Tables(0).Defau ltView '.DefaultView
                > >>>GridResults. DataSource = dvResultsTable
                > >>>End Sub
                > >>>
                > >>>
                > >>>[/color]
                > >
                > >
                > >[/color][/color]


                Comment

                • Paul Bromley

                  #9
                  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:1078m0c389 f8lfb@corp.supe rnews.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:10760q14kj bofda@corp.supe rnews.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:-
                  > >>>
                  > >>>dsResultsTab le.ReadXml(Appl ication.Startup Path &
                  > >>>"\Textfiles\ ResultsTable.xm l")
                  > >>>
                  > >>>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\Micros oft 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[/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??
                  > >>>
                  > >>>ResultsPathX ML is being sent to the user control as
                  > >>>(Application .StartupPath & "\Textfiles\Res ultsTable.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 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\ ResultsTable.xm l")
                  > >>>
                  > >>>
                  > >>>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)
                  > >>>sResultsPa th = Value
                  > >>>End Set
                  > >>>End Property
                  > >>>
                  > >>>
                  > >>>Later in the code:-
                  > >>>
                  > >>>Private Sub ctlSendResultsE MIS_Load(ByVal sender As Object, ByVal e As
                  > >>>System.Event Args) Handles MyBase.Load
                  > >>>dsResultsTab le.ReadXml(sRes ultsPath)
                  > >>>dvResultsTab le = dsResultsTable. Tables(0).Defau ltView '.DefaultView
                  > >>>GridResults. DataSource = dvResultsTable
                  > >>>End Sub
                  > >>>
                  > >>>
                  > >>>[/color]
                  > >
                  > >
                  > >[/color][/color]


                  Comment

                  Working...