|
I think if you are trying to do this with the ASP code you need to explicitely map the logical path to a physical one before trying the FileExists() function. Search on these lines.
|
|
|
|
|
No, it doesn't work by mapping to a virtual directory either. I wouldn't have posted this question if it were that easy...thank you though for the suggestion.
|
|
|
|
|
Hello,
Is there any property for numeric updown control in C# to make the text part of it to be invisible like we had in VB6.
Thanks,
thatsqlguy
|
|
|
|
|
Hi Buddy:
I am going to serialize object in my xml schema.
for this purpose I get public fields and property
and then serialize this to xml.
but in many cases this serialization raise Stackoverflow exeption
please help me...
|
|
|
|
|
hi,
Show the serialisation bolck of your code.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
string tempstr = "";
XmlDocument xml = new XmlDocument();
XmlDocument tempxml = new XmlDocument();
//m_value is object for serialize
Type objecttype = m_value.GetType();
PropertyInfo[] objectproperty = objecttype.GetProperties();
XmlNode node = xml.CreateNodeXmlNodeType.Element, "DataObject", "");
xml.AppendChild(node);
xml["DataObject"].SetAttribute("type", "object");
for(int i = 0; i < objectproperty.Length; i++)
{
object tempobj = new object();
PropertyInfo pi = objectproperty[i];
if(pi.Name != "Item")
{
tempobj = pi.GetValue(m_value,null);
}
//S is static method from DS class for serialize object that switch type of DataObject and then call S method recursively.
tempstr = DS.S(tempobj);
tempstr = "<" + objectproperty[i].Name + ">" + tempstr + "";
tempxml.LoadXml(tempstr);
xml["DataObject"].AppendChild(xml.ImportNode(tempxml.FirstChild, true));
}
return xml.InnerXml;
|
|
|
|
|
Hi buddy:
I going to write a method that read an custom serialized object(in xml format) and then
create object's field dynamically from this xml and then instantiate bject from this
type and then set values of this object.I can't find good article for this purpose.
thank u for your help.
|
|
|
|
|
hi,
Which sort of article you want.
serialisation ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Are linking Console Windows..the same as linking WindowApp Forms?
If not please send some code how to..i don't have a book to look it up, nor freedom of online looking up.
-thanks
George
|
|
|
|
|
Hello,
I've tried filling a tree view with a large database on a worker thread (so my main window keeps responding.)
I get an InvalidOperationException saying that I'm doing it from the wrong thread. If I do it from the main thread, it is very slow, and can take up to 30 seconds.
Any ideas? Thanks,
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
DISCLAIMER: I've never tried this so I don't know if it will work.
Would you be able to generate the tree structure first and then when your data loading thread is finished it fires an event to tell the main thread it is finished. The event handler then takes the nodes and attaches them to the tree control.
This would mean that for 30 seconds you have an empty tree control - but at least the application is responsive.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Mmm interesting idea... I'll give it a try! thanks!
During thos 30 seconds, I could fill the tree with a "Populating tree control, please wait..." node.
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
If you want to modify a control from a thread other than the thread that created it, you should use the Invoke method of the Control (in that case the TreeView) to invoke the function that adds the node to the tree. A simple example for adding a node which takes a string parameter for the node could be:
private void AddNode(string nodeText)<br />
{<br />
myTreeView.Nodes.Add(nodeText);<br />
}
then you can declare a delegate to call this function:
private delegate void AddNodeDelegate(string nodeText);
and then from any thread, you can safely do this:
string nodeText = "This is my safe node text";<br />
AddNodeDelegate myAdd = new AddNodeDelegate(AddNode);<br />
myTreeView.Invoke(myAdd, new object[] { nodeText } );
|
|
|
|
|
I'm making plans to build an application that will be a MDI Host application that loads plugins from a department web server. Does anyone have any examples or advice thaqt they could give on this project?
Thanks
Moebious
|
|
|
|
|
|
Hey all,
Work is really boring so I'm going to write a screen scraper. But the best say to do this is using Regex's, something I need to work on because it's a particular area of weakness. If a page has the following structure:
<html>
<head>
<title>foo</title>
</head>
<body>
<table><tr><td>foo</td></tr></table>
<table><tr><td>foo</td></tr></table>
</body>
</html>
Is there a regex I could use to pick up what's between the tags? Like a regex to grab the title, another for the first table, and the second?
Thanks much
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
Sure, here is a quick example so I am sure you can expand on it:
private void ShowContent(string s)
{
Regex r = new Regex("<td>*[a-z]*</td>", RegexOptions.IgnoreCase);
Match m = r.Match(s);
while(m.Success)
{
string val = m.Value.Delete(0, 4).Delete(m.Value.Length - 4, 4);
if(val != null)
Console.WriteLine(v);
m = m.NextMatch();
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
* is not a wildcard, though - you should actually just use "<td>[A-Za-z0-9]*</td>", which means that 0 or more alphanumeric characters (there are excape sequences you can use, too) are allowed between TD elements. What you have now will match 0 or more openning TD elements as well.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Regex can be horribly unreliable and a complete pain when unforeseen formats creep up. I recommend using SgmlReader[^] written by a fellow Microsoftie. HTML is, if you don't know, an SGML grammar, as is XML and XHTML (which is actually an XML grammar that only looks like HTML because it uses the XHTML namespace as the default namespace so that namespace prefices aren't required).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
I want to know, how can i enable/disable internet access to certain systems on the network ?
Is there any class/... for this ?
Regards,
Asim
|
|
|
|
|
Don't cross post acrossed Forums. It's considered very rude...
There is no class to do this. The best way to do it is a Proxy server...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi
i am trying to make a simple web application using web services with c# web matrix
i have get the data from html page and i can print it on my aspx page
but i could not be able to pass my data to my web services
in my web services i want to send my data in access database
we i show you my code as under that i used ...
this is my html code
<html>
<head>
</head>
<body>
<form id="Form1" name="form1" action="aspx1.aspx" method="post">
<p>
</p>
<p>
First Name:<input type="text" name="fname"/>
</p>
<p>
Last Name:<input type="text" name="lname"/>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
</body>
</html>
this is my aspx page code
<%@ Page Language="C#" Debug=true %>
<script runat="server">
void Page_Load(object src,EventArgs e)
{
String fn,ln;
fn = Request.Form.Get("fname");
ln=Request.Form.Get("lname");
Response.Write("Your First Name is = " +"<b>" +fn +"</b>" +"<br>");
Response.Write("Your Last Name is = " +"<b>" +ln +"</b>" +"<br>");
}
</script>
<html>
<head>
</head>
<body>
</body>
</html>
and this is my web services code
<%@ WebService language="C#" Debug="True" class="my" %>
using System;
using System.Web.Services;
using System.Xml.Serialization;
public class my {
[WebMethod]
public void Add(string a, string b) {
OleDbConnection objConnection = null;
OleDbCommand objCmd = null;
string strConnection, strSQL;
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source="+Server.MapPath(".\\database\\t1.mdb");
// Create and open the connection object
objConnection = new OleDbConnection(strConnection);
objConnection.Open();
// Set the SQL string
strSQL = "INSERT INTO sis (fname, lname) VALUES ( a , b)";
// Create the Command and set its properties
objCmd = new OleDbCommand(strSQL, objConnection);
// here our ionsert query will execute and insertour data in the database.
objCmd.ExecuteNonQuery();
objConnection.Close();
}
}
Mazhar Hussain
|
|
|
|
|
This belongs in the ASP.NET forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
how could one get tree folder browser in C#, like the one that Windows Explorer uses? I looked at all examples given, and have made my own version, but I can't get it to display Network Places. I can get the names of the all volumes connected (HDD, CDs, USB disks...), but don't know how to get Network Places.
So if anyone can point me the right way....
thnx,
ajvn
|
|
|
|
|
ajvn wrote:
So if anyone can point me the right way....
Sure, you will need to P/Invoke many of the Win32 functions and structures to do so, the following should get you started.
[DllImport("mpr.dll")]
public static extern int WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE lpNetResource, out IntPtr lphEnum);
[DllImport("mpr.dll")]
public static extern int WNetEnumResource(IntPtr hEnum, ref uint lpcCount, IntPtr lpBuffer, ref uint lpBufferSize);
[DllImport("mpr.dll")]
public static extern int WNetCloseEnum(IntPtr hEnum);
[StructLayout(LayoutKind.Sequential)]
public class NETRESOURCE
{
public ResourceScope dwScope = 0;
public ResourceType dwType = 0;
public ResourceDisplayType dwDisplayType = 0;
public ResourceUsage dwUsage = 0;
public string lpLocalName = null;
public string lpRemoteName = null;
public string lpComment = null;
public string lpProvider = null;
}
public enum ResourceScope
{
RESOURCE_CONNECTED = 1,
RESOURCE_GLOBALNET,
RESOURCE_REMEMBERED,
}
public enum ResourceType
{
RESOURCETYPE_ANY = 0,
RESOURCETYPE_DISK,
RESOURCETYPE_PRINT,
}
public enum ResourceDisplayType
{
RESOURCEDISPLAYTYPE_GENERIC = 0,
RESOURCEDISPLAYTYPE_DOMAIN,
RESOURCEDISPLAYTYPE_SERVER,
RESOURCEDISPLAYTYPE_SHARE,
}
public enum ResourceUsage
{
RESOURCEUSAGE_ALL = 0,
RESOURCEUSAGE_CONNECTABLE,
RESOURCEUSAGE_CONTAINER,
}
public const int NO_ERROR = 0;
public const int ERROR_NO_MORE_ITEMS = 259;
- Nick Parker My Blog | My Articles
|
|
|
|