|
File.AppendAllText("file1.txt", File.ReadAllText("file2.txt"));
|
|
|
|
|
Nice; a real compact framework would offer
File.Append("file1.txt", "file2.txt");
|
|
|
|
|
Those lazy Microsoft bastards!!! Why haven't they thought of everything yet!?!?!
|
|
|
|
|
|
I have a SqlDataSource on my page that calls a stored procedure that returns the id of a particular record. I am trying to taked the returned id and store that into an integer or string that will be used as a query string for the next page of processing for this record. I'm not exactly sure how to return the value when running SqlDataSource.Select(DataSourceSelectArguments.Empty). Being that SqlDataSource.Select is an enumerator, I cannot return to int or string (even after doing datatype conversion). I'm not quite sure if I can do this, but guidance would definitely be a help. I have shown the code below. Thanks in advance to those below.
//album_id is the string or int to hold returned id from stored proc
albumid;
albumid = SqlDataSource2.Select(DataSourceSelectArguments.Empty);
|
|
|
|
|
I have no idea how to return value that is in js.
I have the website script suchvar zCHAR_ID=0, fCHAR_NAME=2, tCHAR_CLASS=3,
I want to know what they equal in my C# program.
Now my problems I'm having.
I have two webbrowser because they both have diffrent funtions.
one is axWebBrowser1 other is normal webBrowser
webBrowser1.Document.InvokeScript("todo");
how can I do that with axWebBrowser1 so i can delete the webbrowser form?
I know there are more problems but I can't bother without this fixed.
|
|
|
|
|
Can anyone tell me what is the difference between Interop and AxInterop ?
To generate an Interop I simply select it from regeistred COM or BROWSE in Add reference.
I cannot do it for ActiveX. Why ?
Laurent
|
|
|
|
|
I have a custom control with a custom property. After compiling the project I place my custom control onto a windows form in VS2005. From there I change my custom property on that custom control. The problem is that the custom control doesn't repaint on the designer to show my updated change. The following is the only way I have found to make the control repaint. Invalidate() after _Test = value; doesn't work. I also looked into the System.ComponentModel namespace for something to be placed before public int Test like [Browsable(true)] but didnt find anything. I tried [RefreshProperties(RefreshProperties.Repaint)] but I think that only repaints the properties grid and not the control on the designer. Any ideas???
private int _Test = 0;
public int Test
{
get { return _Test; }
set
{
_Test = value;
Width--;
Width++;
}
}
Chris
|
|
|
|
|
Chris,
After using Invalidate(); add the following code.
Application.DoEvents();
Once you invalidate the control, windows still has to go and re-paint it. By using the line above, you are telling it to do any events right now.
Hogan
|
|
|
|
|
Ya thanks a lot. It worked great.
Chris
|
|
|
|
|
Hello,
As snorki said befor Invalidate requires DoEvents, to have an emidiate reaction.
But DoEvents is not a nice solution as it runs the whole message loop again.
I would prefere the Refresh() method.
All the best,
Martin
|
|
|
|
|
hey guys..
anyone know how to make tool tip text in a button..im using C#.net 2003..n_n
|
|
|
|
|
I think you are talking about in windows. Here is some sample code form microsoft help:
private void Form1_Load(object sender, System.EventArgs e)
{
ToolTip toolTip1 = new ToolTip();
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
toolTip1.SetToolTip(this.button1, "My button1");
toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
}
Hope that helps.
Ben
|
|
|
|
|
I'd like to move a Rectangle drawn over a form with the w,s,a,d keys. With the following code it works just fine:
private void Form1_KeyDown(object sender, KeyEventArgs kea)
{
kea.Handled = true;
if (kea.KeyData == Keys.A)
{
graphics.DrawRectangle(myPen_del, a, b, 30, 30);
a -= 4;
graphics.DrawRectangle(myPen, a, b, 30, 30);
}
}
(myPen.Color = black; myPen_del.Color = gray)
But: If I click a.e. 'a' and afterwards 'w', the rectangle i'm moving stucks a bit. That has to do with the windows timer (repeat delay / repeat rate).
What I don't know is how to calculate through KeyDown/Up Event what Keys are pressed and set a selfmade Timer so that the rectangle I'm moving flows and doesn't get stuck every time I'm pressing another button on the keyboard.
Has anyone got a good tutorial for this? Or some sample code about it? I will also gonna include moving the rect in 45° angle by pressing as example 'a' & 'w' together.
By this I will only draw my rectangle in the OnPaint-Event. So can anyone tell me how to manually launch the OnPaint-Event? Cause when I'm doing a Form.Refresh() my integers a and b will be resetted to I was really searching alot for this problem but haven't found anywhere something really helpful
Hope you understood my question and thank you very much in advance for looking into it 
|
|
|
|
|
Hi,
you should manipulate the rectangle's coordinates in the KeyPress event (not KeyUp
or KeyDown) and call Invalidate;
and in the paint handler, you should draw the rectangle.
You wont need the myPen_del to undraw, since the paint handler will redraw
everything.
You may want to use doubleb-uffering to avoid or reduce flickering (see Form/Control
properties).
And you should choose more descriptive names for the rect's coordinates...
|
|
|
|
|
Thanks alot for ur answer, really helps me in some points... The coordinates will be renamed as soon as I got this problem behind me;)
Now the problem's still (as I think) that when I press a button to move the rectangle, it still will get stuck by changing the key pressed... I should really integrate a timer but there I'm really lost^^
|
|
|
|
|
Hi,
I dont really see the problem; when you press a key (say 'a') it generates one
KeyDown, one KeyUp and one KeyPressed. When you keep it down for a while it
autorepeats, i.e. it generates a number of KeyPressed events (same as in a
text editor such as MS Word; I am not sure it may also repeat the KeyDown,
but not the KeyUp). That could be sufficient.
If you want a faster repeat rate, I think you must provide it yourself; this
is how I would do it:
- create method doOneKey(Keys key) that does what that key should do
(including the Invalidate !)
- create a class member: private Keys lastKeyPressed
- in KeyDown do lastKeyPressed=e.KeyCode and call doOneKey(lastKeyPressed)
- create a Forms.Timer and let it tick continuously (say 100 msec)
- in timer tick handler call doOneKey(lastKeyPressed)
- in KeyUp do lastKeyPressed=Keys.None
- dont use KeyPress
You might want to also handle LostFocus event (so the move
stops when your Form loses focus)
BTW I have choosen the Forms.Timer because that one ticks on the GUI thread,
so it can not create concurrency problems (its tick does not get handled in
the middle of a key event).
Hope this helps
|
|
|
|
|
I think I just needed your last answer at least.. I'm just new to C# so I'm sometimes get confused although I should know the solution;) Thank you very very mutch!!
|
|
|
|
|
I try to set the condition for break point, but showing the error that condition is not correct.
I writr like Messageno == "ABC-001"
in condition textbox,
What is the correct way to set the condition?
Plz Guide me.
|
|
|
|
|
There are a couple of ways you can do it. First you can set the break point in the code behind. Then if you go to your break point window you can add a condition to the break point so it will only break when your condition is met. You can also use System.Dianostics.Debugger.Break to cause your code to break point. This only works if you have compiled in a debug mode.
Hope that helps.
Ben
|
|
|
|
|
Hello,
I am showing a form (MyForm) on some click event. I am having some buttons(Send, Get) on MyForm which are not mentioned as predefined event like OK or Cancel etc.
Still i want to know about the click event of the MyForm button.
I want
If(MyForm.ShowDialog() == DialogResult.Get)
{
}
How it can be implemented?????
Thanks..
Gajesh
|
|
|
|
|
Well, I would map the Get button to the OK result. Set the DialogResult for this button to OK. Then, you just need to check for DialogResult.OK.
|
|
|
|
|
You have to set the DialogResult property ycurselfe, before you close the form.
|
|
|
|
|
1st fire Send and Get button events with following code snippets:
btnSend.Click+=System.Windows.Forms.EventsArgs(...)
do same things for Get button.This will allow this event to occur.Now assign Get to Ok event of Dialog box.this will fire Get event when ok is clicked.
happy coding.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Hi,
Very new to C#, and to .Net for that matter (been doing mainly legacy stuff for 20 years). Well, .Net is incredible, but one thing that bums me out is that I pretty much have to trash all the 3rd party component libraries that I have invested my money in over the years and essentially start over.
I've been perusing ComponentSource.com and ran across ComponentOne Studio Enterprise (http://www.componentsource.com/products/componentone-studio-enterprise/index.html). This is coming out of my personal funds, and $899 is *ouch*, but it seems to have just about everything to get a good start.
What do you all think? Any other suggestions to get some good components without making me broke?
Thanks to you all,
J Miller
|
|
|
|