473,549 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

Similar topics

5
4098
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 becomes increasingly difficult to ball park the folder when you go deeper and wider down:
2
1849
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 "../include/config.h" /* Keep this first */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include "../include/complex.h" #include "../include/su3.h"
2
2363
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, and that page use the same control, but this time the control can't find it's images and resources because it is trying to find it in the same...
2
1965
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 are in the folder "Images" of the root ,all the hosting pages for my user controls are also in the root,what kind of path should I use for images in...
0
1293
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 http://www.mysite.com/links.aspx?link=1023. This works fine and makes the site look a lot cleaner. The problem I'm having is with controls on the target page. I...
9
1803
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 http://www.mysite.com/links/1023.apx which is actually internally mapped to http://www.mysite.com/links.aspx?link=1023. This works fine and makes the site look a lot...
2
1353
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 http://localhost/WebApplication that contains a folder http://localhost/WebApplication/images
8
260
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 following:- dsResultsTable.ReadXml(Application.StartupPath & "\Textfiles\ResultsTable.xml") It does not like this, as it takes the application...
11
2252
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 with the include() function! (How shortsighted can you get?) Is there any way at all to use relative paths with include()? Any hacks? If I use...
15
6439
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 make it much easier to slap modualar blocks of markup into page frameworks, which may change and so forth. And the few extra bytes, which even for a...
0
7548
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7743
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7986
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6074
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5114
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3518
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3499
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.