|
KSuthar,
That still doesn't get around the problem of having a hard coded path.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
|
Since DOC node doesn't have child, you only need one loop which iterates the child nodes of BIBLE . See the following code
for (int i = 0; i < bNode.ChildNodes.Count; i++)
{
XmlNode node = bNode.ChildNodes[i];
string strElement = node.Name;
if (strElement.ToLower().Trim() == "doc")
{
string strDocClientID = node.Attributes["CLIENT_ID"].Value;
string strDocMatterID = node.Attributes["MATTER_ID"].Value;
string strDocNumber = node.Attributes["DOCNUMBER"].Value;
string strDocName = node.Attributes["DOCNAME"].Value;
}
} This can be done in a better way if you use XPath .
|
|
|
|
|
Hi,
This only returns the data from the first DOC only
Any thoughts please?
Thanks
|
|
|
|
|
Get a XmlElement and SelectSingleNode of that, instead of the XmlDocument. I am not sure why it is returning SECOND, I am beginner, I had this information thought of sharing, might help you, Let me know if it do help.
XmlDocument doc = new XmlDocument();
doc.Load(strFullPath);
XmlElement root = doc.DocumentElement;
XmlNode bNode = root.SelectSingleNode("BIBLE");
string strBibleClientID = doc.DocumentElement.GetAttribute("CLIENT_ID");
string strBibleMatterID = doc.DocumentElement.GetAttribute("MATTER_ID");
string strBibleDocNumber = doc.DocumentElement.GetAttribute("DOCNUMBER");
for (int i = 0; i < bNode.ChildNodes.Count; i++)
{
XmlNode bibleNode = bNode.ChildNodes[i];
int intElements = bibleNode.ChildNodes.Count;
for (int x = 0; x < intElements; x++)
{
string strElement = bibleNode.ChildNodes[x].Name.ToString();
if (strElement.ToLower().Trim() == "doc")
{
string strDocClientID = bibleNode.ChildNodes[x].Attributes["CLIENT_ID"].Value;
string strDocMatterID = bibleNode.ChildNodes[x].Attributes["MATTER_ID"].Value;
string strDocNumber = bibleNode.ChildNodes[x].Attributes["DOCNUMBER"].Value;
string strDocName = bibleNode.ChildNodes[x].Attributes["DOCNAME"].Value;
}
}
}
|
|
|
|
|
Hello there !
I'm developing a Windows appliciation that involves so called "Transparent Controls". As you would probably know, the only ( as far as i know ) way to achieve a fully transparent control in C# is to add the so called "Transparent style" to your control ("WS_EX_TRANSPARENT"). There are numerous articles how to achieve this and the method is ALMOST always one and the same:
protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020;
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{
}
And that works fine! ( well .... at least all say that ..... and all the articles say so ), but am i missing something or that method has SOME SERIOUS problems that nobody can see ?
For example the Z-order. The following piece of code creates simply a transparent control that draws a line accross itself with a random color:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsApplication16
{
public class HrisTranspControl : Control
{
private Pen _drawingPen;
public HrisTranspControl()
{
Random rnd = new Random();
this._drawingPen = new System.Drawing.Pen(new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(rnd.Next(0,255),rnd.Next(0,255), rnd.Next(0,255))),5);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020;
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawLine(_drawingPen, new System.Drawing.Point(0, 0), new System.Drawing.Point(this.Width, this.Height));
}
}
}
And so ... when u put few "line controls" on top of each other the Z-ORDER goes to hell. You can't change it, its not corrent and it changes randomly each time u select a random "line control".
I've tried A LOT of methods to fix that ( changing the z-order in background, repainting the actual background because i think its because the background is not drawn ... and so on ). None works. I'm out of ideas and the worst part is i've almost finished the application and right in the end i realize that bug and it kills me.
Please help !!!
http://xs135.xs.to/xs135/09015/z-order696.jpg.xs.jpg[^]
The "line controls" were added in the order shows 1,2,3 , but the Z-order appears to be different ( 1,3,2 ). In the current case "bring to front" , "send to back" doesnt change the Z-ORDER
|
|
|
|
|
I think your problem stems from a misunderstanding of the meaning of WS_EX_TRANSPARENT . It has nothing to do with visual transparency; it makes a window 'transparent' to mouse clicks. In other words, the click goes through to the window underneath. If you're trying to use the mouse to select such a window you are bound to get confusing results! You probably don't need that style at all.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
i want to see the subreport of given rdl report in report viewer.
|
|
|
|
|
hello
I'm trying to upload to database object of type byte[], currently using C#/byte[]/DbType.Binary (implementation in progress) and database column "varbinary(MAX)" with SQL Server. But I then realize this is SQL Server specific and would really prefer something that's database independent.
Also haven't tried the part with IDataParameter.DbType = DbType.Binary yet, not sure if this is right because I was reading an article - varbinary goes with SqlDbType.VarBinary, not sure if DbType.Binary is correct at all.
Thanks
dev
|
|
|
|
|
System.Data.DbType and corresponding provider specific DbTypes are linked so using the System.Data.DbType should match correcly to the corresponding DbType.
However, if you're making this database independently, have you considered using OleDbConnection against all databases.
|
|
|
|
|
I want to use C# to save the changes made to an existing excel file. The path of the excel file is fixed and it can be assumed that the file is opened in an excel window from before. All I want to do is write a program that periodically saves whatever changes were made to the file (in the excel window) since it was last saved. I have tried sending the Ctrl-S windows message to excel and also tried playing around the Microsoft.Office.Interop.Excel namespace, but to no avail. Is there a way to do this that anyone is aware of? I am using Office 2007 but a solution for Office 2003 or 2002 will also be of help to me.
--
Nikhil
|
|
|
|
|
When the Excel is opened then you have to attach your application to existing Excel process. The Save method works for me.
|
|
|
|
|
Can you write some sample code to attach an object of Microsoft.Office.Interop.Excel.Application to an already existing excel.exe application?
|
|
|
|
|
Hi everyone,
I am working in button click event and i want to get row index of selected row.
Kindly let me kknow.
Thank you in advance
(Riaz)
|
|
|
|
|
|
YourDataGrid.SelectedRows[0].Index
First check if YourDataGrid.SelectedRows.Count > 0
|
|
|
|
|
This is how to get selected row from DataGridView in .NET 2.0
Make sure there’s a single cell that is currently selected
Get current row index using {datagridview instance}.CurrentCell.RowIdex
Get the selected row using {datagridview instance}.Rows({current row index}).Cells({zero based index}).Value
Here’s the sample code :
Dim crow = DataGridView1.CurrentCell.RowIndex
dim txt as string
Try
txt = DataGridView1.Rows(crow).Cells(0).Value & ” || ”
txt = txt & DataGridView1.Rows(crow).Cells(1).Value & ” || ”
txt = txt & DataGridView1.Rows(crow).Cells(2).Value
MessageBox.show (txt)
Catch ex As Exception
‘ do nothing
End Try
WaelA
Senior Software Engineer
http://www.linkedin.com/in/waelalwirr
abu_wer@hotmail.com
|
|
|
|
|
Hi,
I want to change some looking of some control.
For example - i want to change some Button to be circle.
How can i do it ?
Thanks.
|
|
|
|
|
You can handle the paint event and do your own drawing. This[^] was my first hit when I searched.
|
|
|
|
|
Alternatively, you can do something like I did in this[^] reply if you don't want to handle the drawing of the entire control, this was for a pictureBox but works for other controls too.
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)
|
|
|
|
|
Dear All,
I have a network program which has client and server.
The server will be listening the client at a specific port and IP address.
The client is connecting and writing the data to the server.
When the client connection is established the server will continuously listen the client and gets the packet sent by it.
When the time goes on the server takes up lots of memory in RAM and the CPU utilization goes to 80 to 100%.
The connection used was TCP.
Can any one tell me why this happens.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
M. J. Jaya Chitra wrote: CPU utilization goes to 80 to 100%
Probably because of incorrect usage of threads. Try to use asynchronous fashion methods (BeginXXX,EndXX) which is very efficient. Hard to tell more without seeing the code.
|
|
|
|
|
M. J. Jaya Chitra wrote: CPU utilization goes to 80 to 100%
looks like you are using while loop, instead of thread.
|
|
|
|
|
I am working on an assignment tt reads in *.cs files fr a given directory and do some evaluation with it. At first i thought it was just a small assignment, so Visual Studio is not required, then when i read my assignment requirement again, I find out tt I might require the use of Visual Studio (as our lec wants us to learn it for our upcoming big assignment).
And my code works under command prompt (can read all the *.cs files) but gives me a FileNotFound Exception when working under Visual Studio environment. Does anyone has any idea on how to solve this problem?
--------------------
C:\Documents and Settings\myname\My Documents\Visual Studio 2005\Projects\Stat
Generator\StatGenerator>StatGenerator.exe
Enter the directory name with the C# files to be evaluated:
C:\Documents and Settings\myname\My Documents\cs
Total of 3 C# files found.
File Name: StatGenerator.cs
author's_unix_id: myname
LOC without comments: 71
LOC with comments: 71
Comments lines: 0
File Not Found: Could not find file 'C:\Documents and Settings\myname\My Docum
ents\Visual Studio 2005\Projects\StatGenerator\StatGenerator\test.cs'.
Enter the directory name with the C# files to be evaluated:
|
|
|
|
|
Not sure I understand you - but when you build the project in VS it places the executable in a specific location (bin\debug by default) so that would be the folder from which any relative paths are generated - i.e. if your program tries to open a file called 'test.cs' without specifying a complete path, then it will just look in the same folder that the exe is in.
So - you could move your files to this folder, copy the exe from this folder to the folder containing the files, or specify the path to the folder containing the files in the program and be explicit when you open them.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|