|
What is the DataSet Visualizer?
Michael
|
|
|
|
|
This is true you are facing problems....
But what is this..?
"I will give more detail in the email and notes about where the problem is it is a very small sample "
Do you want other will code for you...? This is not fare....
If you have many notes and suppose to send the code then why are you not posting here...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
I am not asking you to code anything for me, only to look it over so you may see everything. There is too much code to post it all, the notes are exactly what I ended up posting anyway. If you would like to look at it I will send you a copy.
Michael
|
|
|
|
|
I think their is a problem to passing the data between two classes.
Please ensure that you are returning the right dataset from your function and after filling it you won' using the new keyword.
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
When I remove the new as follows I get the folowing error message:
DataSet dsI;
DataSet1.BSDDataTable BSD;
error message when trying to compile.
"Use of unassigned local variable on BSD"
How do I get around this problem.
Michael
-- modified at 2:38 Friday 23rd November, 2007
So to solve that problem I changed the code to the following:
DataSet1 dsI = new DataSet1(); ( It seems I need to return to this)
DataSet1.BSDDataTable BSD = dsI.BSD; (Object reference not set to an instance of an object)
but I end with the original error "There is no row at position 2"
|
|
|
|
|
Hi All,
Here I go again
I derived an EncodingException from Exception . In my code, when I catch an OverflowException I throw a new EncodingException . The catch and new-throw executes fine.
However, the code I am trying to guard never catches an exceptions. I've read Jeffrey Richter's chapter on Exceptions in CLR via C#[^]. This behaior is neither expected or documented. The guarded code is below. The EncodingException class will be hung off this thread. Any ideas why no exceptions are being caught?
Thanks,
Jeff
int Eaten = 0;
try
{
Eaten = TryParseNested(BytesToConsume);
}
catch (EncodingException ex)
{
Debug.Print(ex.Message);
return -1;
}
catch (OverflowException ex)
{
Debug.Print(ex.Message);
return -1;
}
catch( Exception ex)
{
Debug.Print(ex.Message);
return -1;
}
|
|
|
|
|
[Serializable]
public sealed class EncodingException : Exception, ISerializable
{
private int _Offset = 0;
public int Offset
{ get { return _Offset; } }
public override string Message
{
get
{
StringBuilder builder = new StringBuilder(base.Message);
builder.AppendFormat("Illegal encoding encountered at " +
"Offset {0}{1}", _Offset, Environment.NewLine);
return builder.ToString();
}
}
public EncodingException() : base() { }
public EncodingException(String message) : base(message) { }
public EncodingException(String message, Exception innerException)
: base(message, innerException) { }
public EncodingException(int offset) { _Offset = offset; }
public EncodingException(string message, int offset)
: this(message) { _Offset = offset; }
public EncodingException(int offset, Exception innerException)
: this("", innerException) { _Offset = offset; }
public EncodingException(string message, int offset, Exception innerException)
: this(message, innerException) { _Offset = offset; }
private EncodingException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_Offset = info.GetInt32("Offset");
}
[SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("Offset", _Offset);
}
}
|
|
|
|
|
forgot to mention: there is a project property (Build/Advanced) to check
OFL/UFL everywhere too.
-- modified at 21:23 Thursday 22nd November, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Luc,
Thanks. It does not matter. This will be my last project with this f***ing language. I am totally disgusted by it's behavior and bugs. It's a damn shame I have so much time into this garbage language for this project.
Here is something else which does not work: take the try wrapper off the Method causing the overflow (it is an int.Parse() method). I check the string length before calling int.Parse. If too long, I throw the EncodingException so that C# never generates it's exception.
Guess what the result is... No catch.
Jeff
|
|
|
|
|
Hi Jeff,
I am surprised you got such problems with C#. I've done over 100K lines of code in C#
in the last three years, and never had real problems with it. It works fine for me.
If you want my opinion/advice on your Exception problem, please post the relevant pieces
of code. What are the VS and .NET versions you use?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Jeff,
this is what MSDN tells us on OverflowException:
In languages that detect overflow, OverflowException is the exception that gets thrown. For example, in C#, the checked keyword is used to detect overflow conditions. An OverflowException exception occurs only in a checked context.
So by default you get none...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi Luc,
Luc Pattyn wrote: So by default you get none...
I actually catch it. It's when I throw the EncodingException that the missed catch problem occurs.
I feel like I need an MSDN substciption with this language. There are too many inconsistencies and bugs. I'd like to call Microsoft, place the bug report, and wait for an answer rather than spending hours trying to find my own work arounds.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: Any ideas why no exceptions are being caught?
If your code has no error then no exception will be caught.
If you want OverflowException exception then try the code below.
short shorty = 32767;
int integer = shorty + 1;<br />
try<br />
{<br />
checked
{<br />
shorty = (short)integer;
}<br />
}<br />
catch ( OverflowException e )<br />
{<br />
Console.WriteLine (e.Message);<br />
}
If you want EncodingException (the custom exception that you created), you have to throw this exp like the example below
int Eaten = 0;<br />
try<br />
{<br />
throw new EncodingException("this is encoding exception");<br />
}<br />
catch (EncodingException ex)<br />
{<br />
Debug.Print(ex.Message);<br />
<br />
return -1;<br />
}<br />
<br />
catch (OverflowException ex)<br />
{<br />
Debug.Print(ex.Message);<br />
<br />
return -1;<br />
}<br />
<br />
catch( Exception ex)<br />
{<br />
Debug.Print(ex.Message);<br />
<br />
return -1;<br />
}<br />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hi Michael,
Michael Sync wrote:
int Eaten = 0;
try
{
throw new EncodingException("this is encoding exception");
}
catch (EncodingException ex)
...
} Are you staing that the exception can only be caught in the function that generates it? I have read explicitly otherwise. The CLR is suppose to walk the stack looking for a handler. According to Richter:Another advantage of exceptions is that they do not have to be caught or detected in the place they occur; any code in the thread's call stack can handle a thrown exception.
Jeff
[1] CLR via C#, p. 421, ISBN 9-7807-3562-1633.
|
|
|
|
|
Jeffrey Walton wrote: Are you staing that the exception can only be caught in the function that generates it?
No. This is just a sample.. What I mean is that you have to throw this exception if you wanna get the custom exception...
The following code works too..
private int MyMethod(){<br />
throw new EncodingException("this is encoding exception"); <br />
}<br />
int Eaten = 0;<br />
try<br />
{<br />
Eaten = MyMethod();<br />
}
catch (EncodingException ex)
...
}
You didn't show us what you wrote in your function TryParseNested . If you don't throws your custom exception then this exp won't be caught.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
This would be a joke if I did not spend 5 hours working on this one issue. Everyday, one problem with this language consumes the majority of my time. TreeViews, Splitters, Exceptions. It never ends.
|
|
|
|
|
What is your interest?? If you are not very interested about programming, you should not probably learn about this.. I've seem a lot of people (esp: students) are learning about programming even they are not so sure whether they are really interested or not.. don't tell me that my dad forced me to attend this school even you don't wanna attend.. programming is NOT for every body.. Every body can't be a software engineer, programmer or developer...
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hi Michael,
Michael Sync wrote: What is your interest??
I don't know why I tried this language. I suppose I felt it was time to learn it. I disliked Java in college years ago - and this language reeks of Java. So I've put it off for about 7 years now.
Michael Sync wrote: Every body can't be a software engineer, programmer or developer...
I'm acutally a Security Engineer. I program to supplement my primary skills. I usually program in C++. See Artciles[^]. Most are non trivial.
I somewhat agree with you abiout Richter's book. For example, there's no need for me to exercise the Garbage Collector the way he describes. Otherwise, it's an excellent references (I believe I have all of his books).
As for the ranting of the language, it disgusts me when behavior is not documented and bugs exists. The work around for this bug (I just found it) is to prepend the namespace to the EncodingException. Where the hell is that documented. Why did I not get a compile Error or Warning? I have plenty of other examples.
For example, the TreeView SelectedNode property does not snap the view to the selection properly (TreeView and SelectedNode[^]). Another example is fixing a Splitter Panel's size. Splitter controls do not honor the desire to keep 1 panel fixed size (Splitter Panel Resize[^]). I never did find a work around for the Splitter issue.
Finally, I was never able to add a single resource to a TreeView to populate it's images. I had to break out each 16x16 bit graphic, and it them one at a time. See TreeView Images (Image Array)[^]. Coming from C++, this seems absurd to me. I add a 906x16 graphic, set size to 16. I expect the control to decuce there are 960/16 or 60 images.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: I don't know why I tried this language.
I understand. It happened all the time..
Jeffrey Walton wrote: I'm acutally a Security Engineer. I program to supplement my primary skills. I usually program in C++. See Artciles[^]
I have checked your articles list.. very interesting.. As you are already familiar with programming concepts, you should not have any problem with C# too..
Jeffrey Walton wrote: As for the ranting of the language, it disgusts me when behavior is not documented and bugs exists.
I agreed that the most of MS documentation are not very good..
http://www.codeproject.com/script/comments/forums.asp?msg=2328163
http://www.codeproject.com/script/comments/forums.asp?msg=2328419
http://www.codeproject.com/script/comments/forums.asp?msg=2323999
Those links are not working.. You should copy the permalink from the threads..
Jeffrey Walton wrote: he work around for this bug (I just found it) is to prepend the namespace to the EncodingException.
So, you have solved your problem. Can you share us more about this bug that you just found?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hi Michael,
Michael Sync wrote: You should copy the permalink from the threads..
Forgive my ignorance on this one (I grabbed from 'http' to the message ID in the URL bar). How does one use the permalink copy?
Jeff
|
|
|
|
|
There is some links "Reply | EMail | View Thread | Permalink | Go to Thread Start" included in each thread. If you are using Firefox, you can right-click on Permalink and select "Copy Link Location".
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hi Michael,
Sorry about the delay. Yesterday was all coding and debugging (since I did not have to waste time with UI workarounds). The effect recharged my desire to continue with C#.
Michael Sync wrote: Can you share us more about this bug that you just found?
The basic problem was an exception of user defined type EncodingException was not caught as expected in one source file. In the other source files, I had to explicitly use [Namespace].[Class]. However, in this source file (which is different than the EncodingException source file), the compiler did not Error or Warn when using just [ClassName](EncodingException). But the exception went uncaught.
When I changed From throw EncodingException to ASN1.EncodingException, the exception was caught. This leads me to believe I may have collided with another EncodingException (supplied by Microsoft?). But I was not able to locate the culprit.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: As for the ranting of the language, it disgusts me when behavior is not documented and bugs exists. The work around for this bug (I just found it) is to prepend the namespace to the EncodingException. Where the hell is that documented.
I don't see where type confusion could originate, but then you only showed small parts
of your code.
Anyway I always advice people to use Exception.ToString() and not Exception.Message
to visualize exceptions; doing so you get the entire type, the message, additional
information, inner exceptions if any, and the stack traceback. Hence much more than
the single line of text in Message.
So every catch(Exception ex) {} should contain Console.WriteLine(ex.ToString())
or something equivalent.
BTW: most of your complaints seem to be about .NET, not the C# language.
The classes would behave the same in VB.NET or managed C++. If you're new to .NET
I would suggest you work trhough an introductory book (say one of Microsoft's C# books).
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
If you are not familiar with C# language, don't read "CLR via C#.". This book won't be right for you.. This book is for those who already familiar with C#. You should probably read "Beginning with C#" or something like that until you get used to it..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
hi.. i got a problem creating a treeview which enables user to upload a photo/movie/sound clip through the uploading function and the data will be displayed in the treeview....
what i found on the tutorial is just regarding the treeview arrangement with child nodes...
i can do a function to upload a picture.. but how about movie? and songs clips..
|
|
|
|