473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Nov 20 '05 #1
0 1749

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: jason | last post by:
Can anyone help me find a solution to quickly working out relative paths to a folder in the root of my server... Although it easy when you go - say - two levels down: .../includes it...
2
by: Joe | last post by:
Hi, can someone tell me how to set up relativ paths in VS2003 C++ ? I have some source with a tree directory structure that segments include files in various directories: #include...
2
by: Alex | last post by:
Hi. I need some help on this. I have a user control (a header) in my root directory, and all my pages use that control. Then a created a folder (in my root directory) and put a new page inside it,...
2
by: ALI-R | last post by:
Hi I've created a bunch user comtrols for the footer,header,navigation bar of a webpage ,I have two problems: 1) All the controls are in the folder "Control" of the root and all the images...
0
by: Paul Hatcher | last post by:
I'm using a url rewriting mechanism to make my site's urls more search-engine/user-friendly, so we have http://www.mysite.com/links/1023.apx which is actually internally mapped to...
9
by: Paul Hatcher | last post by:
Sorry to post this again - I didn't use my MSDN alias previously... I'm using a url rewriting mechanism to make my site's urls more search-engine/user-friendly, so we have...
2
by: tsteinke | last post by:
Okay here is the situation I am developing a ASP.Net application locally and then I copy the project up to my web server. I start out by creating an ASP.NET Application ...
8
by: Paul Bromley | last post by:
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...
11
by: MBS | last post by:
I am playing around with some PHP code. I want to put in an include() function so I can include existing HTML code and output it to the browser. Lo and behold PHP does not support relative paths...
15
by: Lars Eighner | last post by:
Aside from the deaths of a few extra electrons to spell out the whole root relative path, is there any down side? It seems to me that theoretically it shouldn't make any difference, and it would...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.