|
Hi
please help me in this:
I have loaded xml document using following DOM class:
XmlDocument xDoc = new XmlDocument();<br />
<br />
xDoc.Load("check.xml");
Now how can i view this xml file similar to internet explorer display?
Either i should draw Rich Text Box or drop WebControl on my the form? I have added WebControl in toolbox but it is disable there.
please help me.
Thank you.
|
|
|
|
|
You can parse, and display Xml documents the way you like. This way you'd build your own parse -hard and long, but maybe you need some functionality there?!-, as long as you follow the W3C standards.
If you wish to take the WebControl shortcut -which would seem reasonable-, I guess that'd be fine! You mentioned in your post that the WebControl -assuming you mean WebBrowser- is disabled. Where? In the Toolbox or in your Form?
PS.
You can search CodeProject and other similar sites for free Xml displaying Control. Maybe you'd find one that suits you.
Regards
|
|
|
|
|
Thanks dear,
WebControl is disabled in mine toolbox. What is right control for the functionality is that WebBrowserControl or WebControl.
Also please tell me steps to perform.
Regards.
|
|
|
|
|
In your Toolbox, look for "WebBrower ". You can find it under "All Windows Forms" or "Common Control".
Use the WebBrowser.Navigate() mthod to open your Xml file.
Regards
|
|
|
|
|
Hi friends,
I am new to this forum. now i want a utility to convert numer to words.
for example 234 to two hundred and thirty four.
i searched in the google.com i could not able to trace it out.
please help me
Thank you in advance
V.Ramesh
|
|
|
|
|
I guess this is your lucky day.;) I made one just few months ago. Here is the code.
It consists of 3 methods. You call the ToLiteral() method and supply it with the string you want to parse. It will subsequently call the other two methods to retreive the literals and the segments names. Forgive me for the poor comment -never been good in commenting-. I included a button click even handler to show you how to test for output and how to use the ToLiteral() method.
private void TestButton_Click(object sender, EventArgs e)
{
MessageBox.Show("4\n" + ToLiterals("4"));
MessageBox.Show("57\n" + ToLiterals("57"));
MessageBox.Show("209\n" + ToLiterals("209"));
MessageBox.Show("8734\n" + ToLiterals("8734"));
MessageBox.Show("24567\n" + ToLiterals("24567"));
MessageBox.Show("973654\n" + ToLiterals("973654"));
MessageBox.Show("2315736\n" + ToLiterals("2315736"));
MessageBox.Show("27065154\n" + ToLiterals("27065154"));
MessageBox.Show("827464876\n" + ToLiterals("827464876"));
MessageBox.Show("1675376283\n" + ToLiterals("1675376283"));
}
private string ToLiterals(string Input)
{
String Output = "";
while (Input.Length > 0)
{
if (Input[0] == '0')
{
Input = Input.Remove(0, 1);
Output += "And ";
continue;
}
if (Input.Length % 3 != 2)
{
Output += ConvertChar(Input[0].ToString());
if (Input.Length % 3 == 0 && Input.Length > 2)
Output += "Hundred ";
else
Output += GetSegment(Input.Length / 3);
Input = Input.Remove(0, 1);
continue;
}
else
{
if (Input[0] == '1')
{
Output += ConvertChar(Input.Substring(0, 2));
}
else
{
Output += ConvertChar(Input[0] + "0");
Output += ConvertChar(Input[1].ToString());
}
Output += GetSegment(Input.Length / 3);
Input = Input.Remove(0, 2);
}
}
return Output;
}
private string GetSegment(int seg)
{
switch (seg)
{
case 1: { return "Thousand "; }
case 2: { return "Million "; }
case 3: { return "Billion "; }
case 4: { return "Trillion "; }
default: { return ""; }
}
}
private string ConvertChar(string ToConvert)
{
switch (ToConvert)
{
case "1": { return "One "; }
case "2": { return "Two "; }
case "3": { return "Three "; }
case "4": { return "Four "; }
case "5": { return "Five "; }
case "6": { return "Six "; }
case "7": { return "Seven "; }
case "8": { return "Eight "; }
case "9": { return "Nine "; }
case "10": { return "Ten "; }
case "11": { return "Eleven "; }
case "12": { return "Twelve "; }
case "13": { return "Thirteen "; }
case "14": { return "Fourteen "; }
case "15": { return "Fifteen "; }
case "16": { return "Sixteen "; }
case "17": { return "Seventeen "; }
case "18": { return "Eighteen "; }
case "19": { return "Nineteen "; }
case "20": { return "Twenty "; }
case "30": { return "Thirty "; }
case "40": { return "Fourty "; }
case "50": { return "Fifty "; }
case "60": { return "Sixty "; }
case "70": { return "Seventy "; }
case "80": { return "Eighty "; }
case "90": { return "Ninety "; }
default: { return ""; }
}
}
Regards
|
|
|
|
|
Hi, Dear Respected Programmers
Kindly let me know, How may I use REGEX? because i do not know about System.??? which will use after pressing dot => System.???
Thank you in Advance
|
|
|
|
|
hi,
this link will help you.
Regex Tutorial
hope this helps you.
Nitin...
|
|
|
|
|
System.Text.RegularExpressions
jamil abou khalil
|
|
|
|
|
System.Text.RegularExpressions
|
|
|
|
|
how to display emp table in to data grid view
valluri kiran babu
|
|
|
|
|
What is an "emp table"? What do you want to do exactly, and what trouble are you facing?
Regards
|
|
|
|
|
|
Hi
I am exporting one datagrid in .xsl file.
So, On particular button click event i have done all coding to save datagrid in .xsl file.
This is fine.
When i select the path to open-save file dialogue box, my excel sheet will get saved, but i want simultaneously to save one another folder to same path , which i am selecting by this open-save file dialogue box.
How can i retrieve the "file-path" which i am selecting from that open-save file dialogue box ?
I want that "file-path" in one variable which datatype is string.
Plz. help me out....
prakash sawant
|
|
|
|
|
This would likely be the trick :
<br />
<br />
string sSelectedFile = null;<br />
if (fileDialog.Show(this) == DialogResult.OK)<br />
sSelectedFile = fileDialog.Filename;<br />
<br />
|
|
|
|
|
Hi All,
I want to get FileInfo objects for only files after a specified time. Means i only want to get file names which are created or modified after a specified time. Is there any way or method in .Net for this ?
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Not directly. You can get all of the files in a directory and then loop through the resulting array checking the last modified/created times. If those times are after the specified time add them to another collection to get the final result.
The other option would be to use interop with some of the Win32 API calls, but I don't know off-hand which functions you would need to use.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi,
I have hosted my ASP.NET 1.1 application on shared hosting server. My application is running fine on localhost but i am not able to get the permission for my two dll files which i have used.
When i try to access that page, it shows the error like....
<i>Required permissions cannot be acquired.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[PolicyException: Required permissions cannot be acquired.]
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2737893
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57
[FileLoadException: Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32
[ConfigurationErrorsException: Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +3487289
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +180
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +3454869
System.Web.Compilation.BuildManager.CompileGlobalAsax() +51
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +462
[HttpException (0x80004005): Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +456
[HttpException (0x80004005): Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3434991
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +252
</i>
I get little bit idea about this, like its due to Medium Trust on shared Host server, but how to resolve that error, please help me out!!!
Regards,
Jay Khanpara
|
|
|
|
|
Hi All,
I am developing some application where in I copy a file if it is not in use. I want to check first whether it is being used or written to by any other process. If it is not being used i will copy it to some folder. Note that this file can be on a Network share. I want some functionality like Handle[^]
This is urgent and any help will be appreciated.
Note that I dont want to implement methods where I will open the file in Write mode and then catch exception to know that the file is in use. This is not the proper method.
There should be some method which windows uses to find whether an exclusive lock exists on a file.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hello,
System.IO.FileInfo youreFile = new System.IO.FileInfo("filename");<br />
if((youreFile.Attributes & System.IO.FileAttributes.ReadOnly) != System.IO.FileAttributes.ReadOnly)<br />
{<br />
}
Have not tested it.
All the best,
Martin
|
|
|
|
|
I am working with two functions that format a byte array in preparation to send down the serial port (which .Net 2.0 is a but rough) and strip the formatting from the bytes recieved. These work fairly well, but in this case I had to make a few variables class wide because of the way .Net serial port works. These two functions have similar form, and as such, they use some common variable names. The one in particular was "checksum". Long story short, I move one of the function's "checksum" to a class-wide global variable and left the other in the function. I.E:
<code>
namespace Coda_Verifier_Pro
{
public partial class MainForm : Form
{
byte checksum;
private void myFunction1()
{
checksum = 0x00; //do stuff with checksum
}
private void myFunction2()
{
byte checksum;
checksum = 0x00; //do stuff with checksum
}
}
}
</code>
Shouldn't the complier catch this? Am I missing something obvious? This is why I hate using Global variables.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
What is it that you were expecting the compiler to catch? In myFunction1 you are accessing the global checksum variable. In myFunction2, you are modifying a local variable (local to the function). The fact that they have the same name is irrelevant to the compiler as it is able to figure out the correct scope for each variable access.
If you want to be clearer about it, you could use this.checksum in myFunction1 which explicitly states you are using the global variable.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I thought in VS2003, it would compile error (or at least warn) of variables in the same namespace that have the same name. While I see how the compiler figures it out, it does not seem like good practice??? What if I DID want to access the global checksum in myFunction2? Would this. still work?
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
As far as I know, the compiler has never generated such a warning for variables.
As far as being good practice, I'm not sure if there are really any rules defined for this sort of issue. There are legitimate times when you want a global (class-wide) variable with a specific name and need to use a local variable (either an explicitly defined local variable or a function parameter) with the same name. It can make things difficult to keep track of which one is being manipulated, but that is generally the only issue I am aware of.
In order to access the global checksum in myFunction2 you have a few choices:
1. Remove the local variable.
2. Rename the local variable.
3. Access the global variable as this.checksume
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I believe that the most common practices are:
:: Always access class member variables using the this keyword.
:: Name class member variables with a leading underscore character.
I have tried both, and they work well. It's a matter of taste which one you want to use.
---
b { font-weight: normal; }
|
|
|
|