|
T is the type and where is a constraint which will ensure T will be a type of ValidationBase . Read about generics[^]
|
|
|
|
|
hello froum
I am writing the elements to xml file on runtime,and also using them. It is working properly.
XmlDocument xmlDoc = new XmlDocument();
string path = AppDomain.CurrentDomain.BaseDirectory + @"\XMLFind.xml";
xmlDoc.Load(path);
XmlNodeList xmlNS = xmlDoc.GetElementsByTagName("testword");
The xml file is in the bin folder.
but the problem is after creating setup the xml file is visible to every body so it can be deleted accidently.
If the xml file is placed in the project then while using the output (after creating its setup) it gives the runtime error
Could not find the C:\Program Files\hts\SetupFinal\XMLFind.xml.
can anybody help me...
Regards
Rahul Adya
|
|
|
|
|
rahuladya wrote: but the problem is after creating setup the xml file is visible to every body so it can be deleted accidently.
There is no way to secure it. Just check the file existence before you read it and tell user if it is not available.
|
|
|
|
|
hello navneeth
Yes i know but the issue is not here, we can secure it by adding it to solution explorer and after creating setup it will not be visible to anybody.
The problem is how to find the xml file present in the project on runtime because the directory path will be changed after deployment.
Rahul adya
|
|
|
|
|
rahuladya wrote: because the directory path will be changed after deployment.
Place it in the application directory. Application.ExecutablePath will give you the current directory where application's exe resides.
|
|
|
|
|
hello froum
I am writing the elements to xml file on runtime,and also using them. It is working properly.
XmlDocument xmlDoc = new XmlDocument();
string path = AppDomain.CurrentDomain.BaseDirectory.Substring(0, AppDomain.CurrentDomain.BaseDirectory.LastIndexOf("bin\\")) + @"\XMLFind.xml";
xmlDoc.Load(path);
XmlNodeList xmlNS = xmlDoc.GetElementsByTagName("testword");
The xml file is in the bin folder.
but the problem is after creating setup the xml file is seen to every body so it can be deleted accidently.
If the xml file is placed in the project then it gives the runtime error
Could not fine the C:\Program Files\hts\SetupFinal\XMLFind.xml.
can anybody help me...
Regards
Rahul Adya
|
|
|
|
|
hello all
How to allow textbox to enter only alphabets using RegularExpression (Regex)
i have added the namespace
using System.Text.RegularExpressions;
Thanks
|
|
|
|
|
regex that allow only alphabets is below
^[a-zA-Z\S]+$.
You can validate the entered text in textbox by this.
Cheers!!
Brij
|
|
|
|
|
hello Brij
can u just show the code in 2 to 3 lines .....
|
|
|
|
|
|
Try handling the KeyDown event for the TextBox . If the character is one you don't want (a digit or punctuation for example), swallow it by setting e.Handled to true . That should work.
|
|
|
|
|
There's a bit more to this than you may think as you'll need to allow navigation and edit key combinations in your text box so just dropping the characters you don't want isn't enough. Also, you'll need to handle pasting of information to make sure it's valid.
I wrote an article[^] that does something similar - only numbers - but it can easily be adapted. It doesn't handle text that may be placed programatically, but a little checking in OnTextChanged would handle that.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
what is the C# equivalent of "atoi" in Visual C++?
thanks
|
|
|
|
|
PAsk the questions in Right forum.Put in C++ forum.
Cheers!!
Brij
|
|
|
|
|
int.Parse or Convert.ToInt32 . They will throw an exception if the string cannot be converted. int.TryParse won't throw an exception, and should be used if the string possible could not be valid.
|
|
|
|
|
But what if you have a string like "us dollars $34cheap". TryParse gives 0 for the result.
atoi would give 34.
Is there anything in C# that does exactly what atoi does in C++?
|
|
|
|
|
I don't know of anyting, but it wouldn't be hard to implement it yourself.
Just walk all the characters in the string, and copy the ones that are numbers to a temporal string, ignoring letters and symbols. Then int.TryParse that temporal string and you're done.
|
|
|
|
|
Hi,
I am using the App.Config file to store few mail settings including the static text that will be used to send the mail. All the key/value pair is working fine except for the static content pair where in I am not able to use HTML formatters to format the mail message. I am using the following statement:
--------------------------------------------------------------------------
<add key="MailStaticContent" value="Hi,<br><br>Please find attached your daily report.<br><br>Thanks,<br>Reporting System<br><br>Note: Do not reply to this auto-generated message. To send mail to the Coordinator, please use the application's 'Send Mail' link.";
--------------------------------------------------------------------------
I get the following message:
Application Configuration file "App.config" is invalid. hexadecimal value 0x3C, is an invalid attribute character. Line 21, position 44. <app_path>\App.config 21 44 <app_name>;
It is a mandate as per the design to use a HTML based mail and the values should be managed through the App.Config.
Any suggestions on how to rectify this issue?
|
|
|
|
|
you're putting tags inside XML. So, HTML encode them and decode them on the other end, or try using XHTML ( I don't think this will work, but you could try ).
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hello all,
I'm using a richTextBox for Converting html file to xml file.
How come that myRichTextBox doesn't respond to Undo/Redo functions by using
default shortcut keys, or even programaticaly (by using Button_onClick
event)?
if(richtxt.CanUndo == true)
{
richtxt.Undo();
}
After typing some text into richtxt, nothing happens when clicking the
button, or using Ctrl+Z... any idea?
please respond me??
|
|
|
|
|
Does the crystal reports developed in WindowsXP worked in Vista or not?
|
|
|
|
|
I'm almost compelled to shout that it doesn't work and won't ever work!
..humor aside, why wouldn't it work? Microsoft spends a lot of money in making sure that the most popular applications keep working when you upgrade. (Be that from W2k to XP or XP to Vista)
I are troll
|
|
|
|
|
how can I write something like this? Is it possible at all?
<br />
IPanel panel;<br />
IDataGrid grid;<br />
switch(AppDomain.CurrentDomain.ApplicationType) {<br />
case ApplicationType.WinForm:<br />
grid = new System.Windows.Forms.DataGridView(...);<br />
case ApplicationType.ASPNET:<br />
grid = new System.Web.UI.WebControls.GridView(...);<br />
case ApplicationType.WPF:<br />
grid = new ???<br />
<br />
panel = findPanel("panel1");<br />
panel.add(grid, 0, 0);<br />
<br />
foreach(DataRow row in grid.Rows)<br />
{<br />
}<br />
I am contemplating possibility of writing a GUI generator... there's no such thing as ApplicationType.ASPNET? or is there?
Thanks
dev
|
|
|
|
|
No, there isn't, but I'm sure you could detect that you're running as the ASP.NET user, or within IIS. Or just work out if you're importing the winforms namespaces, the web namesspaces or the WPF namespaces ( or, at least, using objects from them )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
how can i disable and then enable
explore.exe
|
|
|
|