|
Hello.
Well,here[^] there are many useful posts.
Why don't you use them ?
|
|
|
|
|
hello
I know them,but i do not know how using them.
I want help about them.
thank you
|
|
|
|
|
Hi there.
I have a code like this :
Regex.IsMatch("sth", textBoxSearchTxt.Text.Trim(), RegexOptions.IgnoreCase)
Thus I must extrude ESCAPE CHARACTERS from textBoxSearchTxt.Text
How can I do this by C#
As always thanks in advance.
modified on Monday, August 11, 2008 8:28 PM
|
|
|
|
|
Mohammad Dayyan wrote: Thus I must extrude ESCAPE CHARACTERS from textBoxSearchTxt.Text ( Like + * ( ) ... )
I am confused, + * ()... are not escape chars? what are you trying to exclude none alpha chars?
this RegEx will remove all except alpha-numeric.
string newString = Regex.Replace(oldString, "[^A-Za-z0-9]", "");
Yusuf
|
|
|
|
|
Oh, I'm sorry.
I mistook.
Yusuf wrote: string newString = Regex.Replace(oldString, "[^A-Za-z0-9]", "");
Thank you.
|
|
|
|
|
How do I get the current Date and Time in .NET fw.
Please let me know.
Thanks,
Happy Programming!
Regards,
ctrlnick !
|
|
|
|
|
Is this your purpose?
DateTime time = DateTime.Now;
Console.WriteLine(time);
Console.ReadKey();
|
|
|
|
|
You use DateTime.Now to get the current date and time on the local machine.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
use the above code and add a timer object so that you can refresh your clock ok? choose timer tick event and add the code to it.
nelsonpaixao@yahoo.com.br
|
|
|
|
|
Hello,
I was trying to load data from xml files to SQL Server tables.
I am using XMLTextReader to read from the files. my code's working and loading information to two tables. Except, few fields.
They show no values when read - even though the file contains values for them.
I notice all of them are either unsignedByte or unsignedInt type in the xml schema.
I changed them to strings just to test, but it's doing the same.
I think the datatype is not making any difference, but these elements don't have any attributes and the values are directly in the tags.
So, could be I'm missing something. Here's part of my code:
while (reader.Read())
{ switch (reader.NodeType)
{ case XmlNodeType.Element:
if (reader.Name.ToLower().Equals("decimals"))
{ dec = reader.Value; }
..... break;
case XmlNodeType.Text:
...nothing break;
case XmlNodeType.EndElement:
break;
}
}
Any idea, what's wrong?
Thanks.
|
|
|
|
|
Did you step through your code to see what's happening ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Yes i did. I even used the reader.HasValue property and it's coming up with false.
For some reason, it's not recognizing there's any value - when I do have values.
|
|
|
|
|
I think I found the reason.
For elements that hava values directly in it, no attributes - the control goes to XmlNodeType.Text. So, I need to write my code under this case =>
Case XmlNodeType.Text:
.....
.....
But here, how do I refer to the name of the element? the reader.Name property doesn't work here.
Thanks.
|
|
|
|
|
<b>Hello fellow coders,
Anyone know how to implement a C# script into a html href tag so when someone clicks the link, the script executes?
I've done it with javascript, but I cant get it to work under C#. I'm using asp .net IIs and all the things I need.</b>
<pre> string path = "C:\\Program Files\\Common Files\\Microsoft Shared\\Help 9\\dexplore.exe";
string keyword = "default";///get the keyword from the code somehow...this is just an example
string argumentos = "/helpcol ms-help://ms.vscc.v90 /LaunchFKeywordTopic " + keyword;
/// "/usehelpsettings VisualStudio.9.0";
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(path, argumentos);
System.Diagnostics.Process.Start(startInfo);</pre>
<b>I need that piece of code to be executed when I click a html link, that btw is created dinamically by code.
...
The page source code is this:</b>
<pre>
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>]]>
<script runat="server">
public void opendexplore(){
string path = "C:\\Program Files\\Common Files\\Microsoft Shared\\Help 9\\dexplore.exe";
string keyword1 = "String"; ///"default";get the keyword from the code somehow...this is just an example
string argumentos = "/helpcol ms-help://ms.vscc.v90 /LaunchFKeywordTopic " + keyword1;
/// "/usehelpsettings VisualStudio.9.0";
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(path, argumentos);
System.Diagnostics.Process.Start(startInfo);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="Default.aspx" onclick="opendexplore()">CLICK</a>
</div>
</form>
</body>
</html>
</pre>
<b>Thanks you for your help</b><pre></pre>
|
|
|
|
|
charlieyv wrote: Anyone know how to implement a C# script into a html href tag so when someone clicks the link, the script executes?
Somebody kill me.
My friend, nothing personal. But please atleast read and do a bit of research before starting to prgram something.
|
|
|
|
|
|
I need some help deciding how to store my data. Basically I don't want to have a complicated database because in the end it will be a software on someone else's pc and I don't want them to have to install database services and such, and I don't want to host the database myself. However I could just use an access database right??? Now I could build business objects and serialize them to an xml file, but it's a lot of work building the objects. However xml files are automatically supported and my program can even create one if one is not existent. These are some of the things that are running through my head. I would like some advice on what other factors or which of these factors seem really important to you an why. One factor that I believe is that I have already started building objects but that I am recognizing the time consumption. I have written some 2000 lines of code of business objects but I estimate that it will be 5 times that in the end if I continue down the road I am on. It might not be too late to build a database to do all that these objects do.
|
|
|
|
|
bfis108137 wrote: I don't want them to have to install database services and such
Why not? You can easily use something like SQL Server Compact Edition which the user doesn't have to configure at all.
|
|
|
|
|
I am not familiar with it. Do I do all the configuring in my program and then it is just a file for access by the program like access or does SQL Server Compact need to be installed on the pc as well?
|
|
|
|
|
Sql Server CE runs as a DLL in your application. This[^] article will help.
|
|
|
|
|
Hi,
First of all let me say that this is not an answer but just a bunch of additional questions. When reading your post I was wondering questions like:
- do you need concurrency control? This seems like single user application if your data is located on client, but do you have simultaneous threads accessing the same data.
- how much data do you plan to store. If there's going to be "lots" of it, you may end up with performance issues without a good data store
- how about state handling and transactions. Are they needed
- is referential integrity or key handling needed between serialized data
- is there a reason why you don't want to use datasets for storing data (if theres only a small amount of data)
- security issues of any kind, access rights etc
- backups needed at any time and how they are handled and so on...
Including a database (of some kind) into your project is going to cause some "extra work" for you but it also takes away much coding when it comes to the issues mentioned above. Usually the savings is greater. This approach also adds scalability to your project if needed.
Database can be installed with a very small footprint and the installation usually can be completely added to your deployment mechanism. Some of those databases are (just my preferences) Oracle XE, SQL Server Express Edition and DB2 Express-C. But still, not saying that is the optimal approach to you.
Mika
|
|
|
|
|
It is simply a large data storage app. It basically stores large amounts of data of patients for a vistiting nurse organazation. So it's a list of patients.
- do you need concurrency control? This seems like single user application if your data is located on client, but do you have simultaneous threads accessing the same data.
Only 1 user at a time will be accessing it.
- how much data do you plan to store. If there's going to be "lots" of it, you may end up with performance issues without a good data store
I am not sure on the amount. I suppose it could end up being a lot over time.
- how about state handling and transactions. Are they needed
state handling isn't needed and transactions I can perform with c# code
- is referential integrity or key handling needed between serialized data
Well this is actually one of the benefits of storing objects IMHO. I lets say have an object A. I then make A part of B. When I serialize the object A is actually part of B and there is no need to even relate the objects.
- is there a reason why you don't want to use datasets for storing data (if theres only a small amount of data)
Now I hadn't thought to make a dataset instead of an object. I guess I could serialize the dataset instead.
- security issues of any kind, access rights etc
obviously there could be some security issues but it's just being used on indiviual's pcs
- backups needed at any time and how they are handled and so on...
backups can be handled by the pc
|
|
|
|
|
- is referential integrity or key handling needed between serialized data
Well this is actually one of the benefits of storing objects IMHO. I lets say have an object A. I then make A part of B. When I serialize the object A is actually part of B and there is no need to even relate the objects.
Use of a decent OR mapper will make the persistance transparent. You could take a look at Diamond Binding in my sig.
Your other option is to just go all out and use an object database, and not worry about any impedence mismatch - db4o is pretty good. TBH though its probably easier to hook your-reporting-tool-of-choice up to an SQL database.
SQL Express or Compact can be redistributed easily, so I wouldnt worry about the whole "installing a database server", and both editions can attach a database file from disk. Its a bit harder to find persistance tools that speak Compact's dialect, but its easier to redistribute. SQL Express is probably a good option - being pretty much as good as full SQL Server for common usage.
|
|
|
|
|
I am not saying that it can't be done or is too hard with a db. I was just answering someone elses concern which for me was actually an asset. My main thing is that I don't want these people to have to have to install even a client on their pc. They are a bunch of old computer illiterate nurses and to be honest it's asking too much. To be honest I like the idea of an access database but it has a reutation of not being powerful but it could meet my needs. I heard also you can use SQL serer compacta and the client can become part of your app. Is that true? How can I do that? I end the end want to be able to send the program along with maybe a few files, or just 1 msi file which I have never dealt with b4 and they just unzip them into 1 folder. More than that I feel like would be asking too much
|
|
|
|
|
Compact is a bunch of assemblies that you reference, whereas Express needs to be installed with your app (usually as a merge module for the installer).
Both editions let you, if I recall, specify a local file in the connection string, which is then made available like any other database.
You may as well make a deployment project. You get a nice installer, and all the dependancies are detected for you.
|
|
|
|