|
Haha!
Indeed ... Your right, after I posted that I was thinking "hang on ... they all have merit ..."
There is loads of feedback in the interfact already showing them that stuff is happening like feeding a count to the interface a progress bar and another label showing them detailed info about what is being processed at any given time ... thing is at the moment they can still hit the button and kick off another background working that will basically just do the work again ...
hmm ... time to protect things methinks!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi all
I have 2 classes
Public class DB
{
public dataset select(string Query,string tablename)
{
try
{
//Select logic
}
catch(Exception Ex)
{
throw Ex;
}
}
}
Public class InterActDB
{
public dataset selectQuery(string Query,string tablename)
{
try
{
DB obj = new DB();
obj.select(Query,tablename);
}
catch(Exception Ex)
{
throw ex;
}
}
}
from winform file i create object of InterActDB and anc call selectQuery, if any Exception occured in DB class that can not throw up to Winform try catch .
can somebody help me?
|
|
|
|
|
You will try this...
int result=0;
try
{
DB obj = new DB();
result=obj.select(Query,tablename);
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
return result;
Rajendran.AL
|
|
|
|
|
r aa j wrote: throw new Exception(ex.Message);
This is simply awful! You've just lost all relevant information about the exception and instead just passed the message up the chain. At least add something relevant if you want to throw a new exception:
int result=0;<br />
try<br />
{<br />
DB obj = new DB();<br />
result=obj.select(Query,tablename);<br />
}<br />
catch(Exception ex)<br />
{<br />
throw new Exception("Failed to execute Select",ex);<br />
}<br />
return result;
|
|
|
|
|
thnak for reply. yaa it work fine.
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
Hi evevrybody,
I got a generic list composed by this structure
private struct Msg
{
public UInt16 HD;
public UInt16 Extension;
public UInt16 aps;
}
private List<msg> MessagesList;
what is the most efficient way to get access to Msg element using Extension identifier?
thanks for help!!!
|
|
|
|
|
|
thanks for help could you specify it in my code?
|
|
|
|
|
Nothing needs to be added to your code, you use Find in the code trying to find one of your elements. Did you even read the documentation I linked to?
|
|
|
|
|
hi all,
i have a problem with custom controls. whenever i place a custom control on a form it doesn't paint correctly. infact it doesn't use my overriden OnPaint function and shows its type full name as its text. the background is always white :/. i suspect it is dependent on some settings of a project, because when i just created new project and did exactly the same thing everything went fine... in runtime the OnPaint etc. is executed correctly. do you know what might be teh reason of such behaviour? thanks in advance
|
|
|
|
|
|
An article that I wrote might be able to help you: Targeting Design-Time Events of User Controls[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi,
I am developing an windows application in which i have to add 5 different TTF fonts in my application so i want to know how to embedded these fonts to my application programatically...
Thanks
|
|
|
|
|
Look at the PrivateFontCollection class and embed the fonts as embedded resources.
|
|
|
|
|
|
Hi, anyone can help me. I have xml like this :
<Table>
<KdProject>999999</KdProject>
<NmProject>Other Project</NmProject>
</Table>
<Table>
<KdProject>901561</KdProject>
<NmProject>Bussan - 2891000497 - Citrix</NmProject>
</Table>
<Table>
<KdProject>901559</KdProject>
<NmProject>Acer - 288 - LAN Switching </NmProject>
</Table>
<Table>
<KdProject>901560</KdProject>
<NmProject>Microsoft - 2881001136 - LAN Switching </NmProject>
</Table>
I want to delete this nodes
<Table>
<KdProject>901561</KdProject>
<NmProject>Bussan - 2891000497 - Citrix</NmProject>
</Table>
<Table>
<KdProject>901559</KdProject>
<NmProject>Acer - 288 - LAN Switching </NmProject>
</Table>
I use this code :
XmlDocument myXml = new XmlDocument();
myXml.Load(pathXML + "Project.XML");
XmlNodeList nodes = myXml.GetElementsByTagName("KdProject");
for (int i = 0; i < nodes.Count; i++)
{
DataTable dt = dsProject.Tables[0];
foreach (DataRow row in dt.Rows)
{
if (nodes[i].InnerText == Convert.ToString(row["KdProject"]))
{
XmlNode xmlnode = myXml.DocumentElement.ChildNodes.Item(i);
xmlnode.ParentNode.RemoveChild(xmlnode);
}
}
}
myXml.Save(pathXML + "Project.XML");
But I have error messages in
if (nodes[i].InnerText == Convert.ToString(row["KdProject"]))
that nodes[i].InnerText is null
Can anyone help me?
Thx
|
|
|
|
|
Sorry thats not valid XML, you cant have multiple root elements. Fix it, then try again.
|
|
|
|
|
This are completed xml, please help
Thx
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<KdProject>999999</KdProject>
<NmProject>Other Project</NmProject>
</Table>
<Table>
<KdProject>901561</KdProject>
<NmProject>Bussan - 2891000497 - Citrix</NmProject>
</Table>
<Table>
<KdProject>901559</KdProject>
<NmProject>Acer - 2881001136 - LAN Switching </NmProject>
</Table>
<Table>
<KdProject>901560</KdProject>
<NmProject>Microsoft - 2881001136 - LAN Switching </NmProject>
</Table>
</NewDataSet>
|
|
|
|
|
A nested loop is a very bad idea, performance wise. Use XPAth to find the nodes you want.
Also, you shouldn't be iterating over a collection as you remove thigns from it. You should build a list of items to remove, then iterate over that, removing them from the original document.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I still confuse and stuck how I change my code?
Thx
|
|
|
|
|
As you've already been pointed out, itterating over every node is both inefficient and unnecessary.
I suggest you read up on XPath , which gives you a way of navigating to specific nodes using the SelectSingleNode and SelectNodes methods on an XmlNode .
The XPath you want looks for Table nodes with a specific content in the KdProject child. It looks like this for example: Table[KdProject = '901561']
So you can find the node you're after using (assuming xDoc is the XmlDocument instance):
XmlNode node= xDoc.DocumentElement.SelectSingleNode("Table[KdProject = '901561']")
and you can delete that node:
xDoc.DocumentElement.RemoveChild(node);
you should now be able to adapt your code to use this to repeat the deletion for every row in your data table.
|
|
|
|
|
I think the code, can remove just one row, how I can remove xml node based on KdProject tags
The original xml :
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<KdProject>999999</KdProject>
<NmProject>Other Project</NmProject>
</Table>
<Table>
<KdProject>901561</KdProject>
<NmProject>Bussan - 2891000497 - Citrix</NmProject>
</Table>
<Table>
<KdProject>901559</KdProject>
<NmProject>Acer - 2881001136 - LAN Switching </NmProject>
</Table>
<Table>
<KdProject>901560</KdProject>
<NmProject>Microsoft - 2881001136 - LAN Switching </NmProject>
</Table>
</NewDataSet>
The result that I want :
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>
<KdProject>999999</KdProject>
<NmProject>Other Project</NmProject>
</Table>
<Table>
<KdProject>901560</KdProject>
<NmProject>Microsoft - 2881001136 - LAN Switching </NmProject>
</Table>
</NewDataSet>
Please help,
Thx
|
|
|
|
|
Are you being serious??? If you can't work out how to do that from the code i provided then you need to go and buy a beginner book on programming and work through it.
|
|
|
|
|
Hi
I have a problem,
I have one textbox, and one datagrid.
If value in textbox is matching with value in specfic colum in datagrid then select this row in datagrid
|
|
|
|
|
You forgot to tell us your problem.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|