|
My guess is that the times you get the error its because "string or binary data would be truncated".
Not sure why I think that though, it might have something to do with the error message. Of course, you might not understand what that error actually means, but google does[^]
|
|
|
|
|
DataAdapters are evil and should be avoided. If you want to insert some data, just insert it, it's not difficult and you'll be better off.
|
|
|
|
|
public class Grammer
{
private MyString[][] lst = new MyString[4][];
private MyString[] a = { new MyString("eval",'n'), new MyString("exp",'n') };
private MyString[] b = { new MyString("exp",'n'), new MyString("fact",'n'),new MyString("exp + fact",'n') };
private MyString[] c = { new MyString("fact",'n'), new MyString("num",'n'), new MyString("( exp )",'n') };
private MyString[] d = { new MyString("num",'n'), new MyString("(0|1|2|3|4|5|6|7|8|9|)+",'t') };
public Grammer()
{
lst[0] = a;
lst[1] = b;
lst[2] = c;
lst[3] = d;
}
}
class MyString
{
private String lst;
private char terminal;
public MyString(String s, char c)
{
lst = s;
terminal = c;
}
}
static void Main(string[] args)
{
int lstcount = 0;
Grammer lst = new Grammer();
Console.ReadLine();
}
Hello...
The private members are visible in main.
How?
|
|
|
|
|
hotthoughtguy wrote: The private members are visible in main.
Private members of Grammar class?
|
|
|
|
|
|
I tried your code and I can't see private members of that class from main .
|
|
|
|
|
It shouldn't disply private members.
|
|
|
|
|
amazingly i can see them from main
|
|
|
|
|
Its really amazing
cause even i couldn't see private members.
|
|
|
|
|
Weird.. I tried the code as well and I can't access any private members. For instance, the code
lst.a = null;
does not compile.
Can you show the code that allows access to these members?
|
|
|
|
|
hotthoughtguy wrote: The private members are visible in main.
Well they shouldn't be
I'd try restarting Visual Studio, maybe it glitched
|
|
|
|
|
What do you mean by "visible" - do you mean you can access them in code, or that you can see them with intellisense / the debugger?
If it's the latter, then you're misunderstanding what private really means
|
|
|
|
|
Is Main a member of the Grammar class? If so, of course it can see the private fields.
|
|
|
|
|
Hi,
In VB.Net in a class I can define an event as:
Public Event MyEvent
and raise it in a method as :
RaiseEvent MyEvent
and in another class that has an instance of first class I can catch the event.
How can I do this simple process in C#? We don't have RaiseEvent in C#.
Actually I want to notify another class when a method executes in the class.
Best wishes
|
|
|
|
|
You look at the delegate as a method call. Don't forget if nothing's hooked up to it, it'll be null. So check for that.
if(this.MyEvent != null)
this.MyEvent(MyArgs);
|
|
|
|
|
see This
Hope it'll help.
|
|
|
|
|
|
Hey guys
How would I go about saving an image of a control? Lets say for instance I'm drawing something on a panel using GDI+, I need to save that drawing to JPEG. Been googling around but no joy.
Any help will be appreciated
Thanks
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
Control.DrawToBitmap is the general answer, some Controls (such as RTB) need a bit more effort though.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
DrawToBitmap doesn't works for ActiveX controls like WebBrowser.
You would better use Graphics.CopyFromScreen but It works for active window only.
Life is a stage and we are all actors!
|
|
|
|
|
What I do in my screen grabber applet is...
Define a bitmap of the appropriate size:
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap
(
this.pPanel.Width
,
this.pPanel.Height
) ;
Get a Graphics object for the bitmap:
using ( System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage ( bitmap ) )
Copy the area of the screen that the Panel covers to the bitmap:
gr.CopyFromScreen
(
this.pPanel.PointToScreen ( new System.Drawing.Point ( 0 , 0 ) )
,
new System.Drawing.Point ( 0 , 0 )
,
this.pPanel.Size
) ;
Save the bitmap to a file (I prefer PNG):
bitmap.Save ( sw.BaseStream , System.Drawing.Imaging.ImageFormat.Png ) ;
(Details left as an exercise.)
|
|
|
|
|
Hello,
I've a timer that run every 1 second (and do some check),
how can i insert it to a thread? because it interrupt to my application.
can someone please help me here?
|
|
|
|
|
tamir101 wrote: I've a timer that run every 1 second (and do some check),
Is that a System.Windows.Forms.Timer or System.Threading.Timer ? First one runs on the main thread and second one runs on a pooled thread.
If you are using Forms.Timer , consider changing to Threading.Timer . This[^] MSDN article will help.
|
|
|
|
|
Hi,
Can you please explain me how to use it?
I can't understand how i need to do it...
|
|
|
|