|
catch(Exception ex)
{
MessageBox.Show("Error info :"+ex.message.toString(),"Error Message",MessageBoxButton.Ok,MessageBoxIcon.Error);
}
I am catching all exceptions professionally. the above is a small eg: to know you how i am getting information out out.
I nevar feel this much mental tension in my life. why because one product is still in shelf because of this problem.
Sreejith S S Nair
|
|
|
|
|
Actually, that's not professionally. Professional exception handling typically entails sending exception informatio to a dispatch block of sorts that is configurable and can display message boxes, raise WMI events, and much more. For example, see the Exception Management Application Block for .NET[^], part of the Microsoft Patterns and Practices initiative.
In any case, then next thing to do - as I mentioned earlier - is to step through your code in the try block and see if there isn't some other error. Without seeing your code (not just the data layer code, but also the binding code), it's impossible to tell. You need to debug your code by stepping through it and finding the error. Debugging is just part of development.
It's possible that an exception is not getting thrown but you have some conditionals that are not satisfied. Take this simple example:
SqlConnection conn = null;
SqlCommand cmd = new SqlCommdand("SELECT * FROM MyTable");
try
{
if (conn != null)
{
}
}
catch (Exception ex)
{
} This is very simple, but should describe what I'm talking about. Also, make sure that you're deploying the .config file with the application, using the same name as the app and in the same directory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
now i got a little idea.
i already told you that all my combo box are grouped inside groupbox(actually this is for group disposal or clearing).
Now i excluded all group box.Insted of that i placed panel controls.
now i can view the data.
but the groupbox problem in still in my mind even though i got solution.
thnaks for your continous talk.
Sreejith S S Nair
|
|
|
|
|
There's no reason the GroupBox would interfere like that. I've done it many times with absolutely no problems. The GroupBox is a container control similar to the Panel . Something in your code just isn't right, but without seeing it I really can't say.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
good morning
do you want my source file to check
Sreejith S S Nair
|
|
|
|
|
Sorry, but no. I'm very busy and don't have time to go over source code, especially when the exact nature of the problem isn't known. I recommend you debug your application and step through the code to find out what's happening. Go through line by line and check the state of relevent objects as you go. Debugging is all part of the fun.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
i'm sorting my Xml-file with xsl. Works fine but when i want to sort my column descending, he doesn't do it. It's exactly the same as ascending. What am i doing wrong then?
XslTransform xslt = new XslTransform();
xslt.Load(xslFile, null,null);
xslt.Transform(filePath,filePath,null);
dsT.Clear();
dsT.ReadXml(filePath);
My xsl file looks like this
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()">
<xsl:sort data-type="text" select="name" order = "descending" />
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
My xml file looks like this
<?xml version="1.0" encoding="utf-8"?>
<packageconfig version="1.0">
<tables>
<table name="TransMst">
<description />
<tablegroup>programs</tablegroup>
</table>
<table name="UserCmp">
<description />
<tablegroup>settings</tablegroup>
</table>
<table name="UserPrf">
<description />
<tablegroup>settings</tablegroup>
</table>
</tables>
</packageconfig>
|
|
|
|
|
Get rid of the spaces after the order attribute and the = sign.
Also, why are you going to these lengths to sort data? Simple create a DataView on your DataTable and call Sort . Use that DataView for data binding then. It works in place of a DataTable . If you use DataGridTableStyle s, you still use the table name for the DataGridTableStyle.MappingName property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
the spaces are not the problem because i'm doing the exact same thing a second datagrid. I have made a private to sort the xml with a parameter (ascending or descending). In the first datagrid he sorts descending and when i do the same thing in the second datagrid he doesn't do it and sorts ascending instead.
|
|
|
|
|
Have you actually stepped through your code to make sure that the DataTable contains the sorted data? A DataGrid can apply a default sort based on the DataTable 's DefaultView . This why you're supposed to use a DataView on your DataTable and bind against that like so:
DataView view = new DataView(dataTable1);
view.Sort = "MyColumn DESC";
dataGrid1.DataSource = view; See the DataView.Sort property documentation in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok thx!
is it also possible that he wont sort it because i'm sorting my xml on an attribute?
|
|
|
|
|
If you're sorting against an attribute, you should use "@name", not just "name". I didn't catch that before. Still, a DataView is the best way and most efficient way to go. Why go to all the trouble of using an XSL Transform just to sort data and have to read it back in?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
yesss thx! the @ was the problem.
I know that a dataview is easier but last time i had problems with it so i wrote a Xslt-file. Now i can re-use that code so it's just copy paste now, except the problem with the @
|
|
|
|
|
Hi,
I have a treeView Control. I am adding a node with text . The text is very large one. It is giveing scroll bar for the tree view but all the text is not visible (the text is very large around 1000characters). How can I change the properties to make the entire text visible.
Karteek
|
|
|
|
|
Why on earth would you put a string that long in a TreeView? That is more like detail that should be displayed on some other control. I'm just saying this because if I saw an application do something like that, the first thought in my head would be "WHAT WERE THE DEV's THINKING WHEN THEY DID THIS?!?!"
Now, the TreeView control doesn't support putting huge strings on multiple lines in a single node. You COULD break up that string into multiple nodes under the same parent node. Or you could attempt to ownerdraw the TreeView, but that's not exactly easy. Another option would be to check out an alternate TreeView control from, say, Infragistics...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I usually don't have such long strings in my control but in some case I amy get such strings. So I want this.
Karteek.
|
|
|
|
|
You may want it, but would anyone else want to use it?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Actually I am reading the input for the tree from a file . So I can have any type of text in the file.
Karteek
|
|
|
|
|
Hi
Im creating a service application which has the job of watching if my main application is running.
If my application is not running, I wish to start it, but this is where my problems ocures.
It seems that my service application correctly sees that my program is not running, but when it starts the program it just never shows up.
If i take a look in my process list, the program has been started but the GUI (a simple form) is just never shown.
I have a feeling that its because the process is also started in the context of the windows service, and therefor does not support a GUI.
If i run my code in a standard windows app, it works just fine.
Has anyone got any sugestions?
Heres the code I use to check and start up my application:
Process[] processes = Process.GetProcessesByName("WindowsApplication4");
if(processes.Length != 1)
{
Process tallyMachine = new Process();
tallyMachine.StartInfo.FileName = "C:\\WindowsApplication4\\WindowsApplication4.exe";
tallyMachine.StartInfo.WorkingDirectory = "C:\\WindowsApplication4";
tallyMachine.Start();
}
Any help would be greatly appreciated
Regards
Janus Klok
|
|
|
|
|
Hi,
Try this...
tallyMachine.startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Add this line in your code and see if it works...
Hope this solves your prob...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Thank you for your sugestion.
I havent tried it thoug as the other solution wich is postet to this problem, solved the problem.
Regards
Janus
|
|
|
|
|
Klok wrote:
I have a feeling that its because the process is also started in the context of the windows service, and therefor does not support a GUI.
Your absolutely right! This IS what's happening!
To fix this this, try going into the Services manager, click the Properties of your service, change the logon to "Local System Account", then enable "Allow service to interact with desktop". This should take care it.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Great
This works absolutly perfect.
Thank you very much.
Regards
Janus
|
|
|
|
|
Another alternative is to set the credentials of the service to a user with "Log on Locally" and "Log in as a Service" rights. What Dave said is perfectly fine, but it runs with SYSTEM privileges. Just something to think about depending on what your application does.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'am trying to retrieve a graphics object from an image object using the piece of code given below
Graphics GDC = Graphics.Getimage(objImage)
But it is throwing the exception...graphics cannot b retrieved from an image having INDEXED PIXEL FORMAT.Cud u tell me the reason y???
Nature of my work:
I'am trying 2 draw some shapes on 2 an image in a picturebox control.After drawing the image i need 2 rotate the image.While rotating i need my drawings also 2 b rotated.
I have tried it with all sort of transformations and then also itz not working.So i thought of retrieving the graphics object from the image and draw the shape(rectangle) using that so that while i'am rotating the image the drawing is also rotated.
Pleez help me as i'm less xperienced in C#
Regards,
MMX
|
|
|
|