|
the code which i posted can work in both console and windows.. dont confuse with Debug.Writeline satement, it is just used to print in Output Window.
ie.
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
int x = 5;<br />
if (x == 5)<br />
{<br />
Debug.WriteLine("more code to runs here1");<br />
Debug.WriteLine("more code to runs here2");<br />
if(done) <br />
return;
else<br />
{<br />
Debug.WriteLine("more code to runs here3");<br />
Debug.WriteLine("more code to runs here4");<br />
Debug.WriteLine("more code to runs here5");<br />
}<br />
}<br />
Debug.WriteLine("more code to runs here6");<br />
Debug.WriteLine("more code to runs here7");<br />
Debug.WriteLine("more code to runs here8");<br />
<br />
}<br />
the return statement will exit from the funtion button1_Click.
Srini
|
|
|
|
|
thank you so much that was exactly what i needed it should worl and i will tell you tomorrow if it does
|
|
|
|
|
hey engsrini thanks so much for helping me i had no idea what i was looking for but you helped alot thanks alot
|
|
|
|
|
|
RaiseEvent is a VB only hack. You don't need it, the mouse up actually has the co-ordinates, and you can call any delegate you like with them.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hello!
Some applications uses SSO(Single Sign On). For example, Lotus Notes, Source Safe and atc.
I have found some material, but i don't know is there some standart classes for implementing such systems like in applications mentioned before? I have a program. And i wanna modify it - add SSO supporting (user once input his login and pass and for the next time application runs without requesting authentication data but take it using user accaunt in OS). What may i do?
Help, please...
ISQ 469907496
|
|
|
|
|
It still remain valid! )
ISQ 469907496
|
|
|
|
|
I'm new to form programming in C#. Just for learning purposes, I tried double buffering to get rid of my flicker problems with a simple test program. The problem is, that enabling double buffering made increased my flicker exponentially. What should I do to solve this?
Here's the code for reference
public partial class DoubleBufferPractice : Form
{
Timer timer;
Rectangle rect;
public DoubleBufferPractice()
{
InitializeComponent();
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
rect = new Rectangle(0, this.Height/3, 50, 50);
InitializeTimer();
}
private void InitializeTimer()
{
timer = new Timer();
timer.Interval = 10;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
private void timer_Tick(object sender, EventArgs e)
{
if(rect.X + rect.Width < this.Width)
rect.X += 10;
else
rect.X = 0;
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
using(Graphics g = this.CreateGraphics()) {
using(Brush brush = new SolidBrush(Color.Magenta)) {
g.FillRectangle(brush, rect);
}
}
base.OnPaint(e);
}
}
Also, I'm testing this on my laptop with a 2.0ghz Dual Core Pentium, 2gigs ram, and a 256meg nonshared vram NVidia Geforce 8600 M GT, so I don't think that hardware is the problem.
|
|
|
|
|
Hi,
first of all, do NOT you this.CreateGraphics(). Just use e.Graphics available from parameter like this:
protected override void OnPaint(PaintEventArgs e)
{
using(Brush brush = new SolidBrush(Color.Magenta))
{
e.Graphics.FillRectangle(brush, rect);
}
base.OnPaint(e);
}
second of all, interval is in miliseconds so this timer.Interval = 10; will redraw whole form 100 times per second. It may flicker even on good computer.
hth
|
|
|
|
|
Thank you so much.
changing it to e.Graphics fixed everything. Also, it went from extreme flicker (practically disappearing for a full second or two) to incredibly minor flicker at a 10ms interval.
|
|
|
|
|
Hi to all,
I have a program that recieve a txt file and work the text in it.
The problem its that wend i take the text from the file to a string hi have unrecognized characteres in the positions where i should have accent letters like á or ö for instance.
So i tink that the better way is to encode the txt file in utf8.
Is there any way to do it in the code lines?
Paulo Caeiro
|
|
|
|
|
Have you solved this?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Yes, i already have solved that question...
Do you need anything?
PC
|
|
|
|
|
pcaeiro wrote: Do you need anything?
No. I was just curious if you still needed help with your problem. Glad you solved it
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi guys this may sound stupid but i have already search on google and cp but unfortunately couldn't find what i was searching. I want to display a four sided handle on my control on form1.cs. I am able to disable my control but want to provide a functionality so use can select lets say right side handle to increase the control size. I tried googling like 4 sided handle on control.
Can anybody provide me a resource link. Thanks
|
|
|
|
|
|
Thanks for helping me out. Certainely, I am able to move the control around but how can I display 4 sided handles around the edege of the Square box.
|
|
|
|
|
Hey
the following code isnt working, its supposed to add a day every time the loop iterates but it doesnt...
can anyone tell me why?
DateTime start = new DateTime(2007, 01, 01);
private void button1_Click(object sender, EventArgs e)
{
SqlConnection sqlConn = new SqlConnection("User id = 123; Password = 123; Initial Catalog = 123; Data Source = 123");
sqlConn.Open();
SqlCommand cmd = sqlConn.CreateCommand();
for (int i = 0; i < 10; i++)
{
start.AddDays(1);
cmd.CommandText = @"INSERT INTO LoginLog (Lil_UserID_SI,Lil_PC_Name_VC15, Lil_Time_DT) VALUES(0, '" + Environment.MachineName + "', '" + start + "')";
cmd.ExecuteNonQuery();
}
sqlConn.Close();
MessageBox.Show("Done");
}
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
They've hidden the reason in the documentation[^] again!
Attention to the Return information:
Return Value
Type: System..::.DateTime
A DateTime whose value is the sum of the date and time represented by this instance and the number of days represented by value.
|
|
|
|
|
haha, it worx
sorry man, ive been coding 13 straight hours, my brain isnt as fresh as this morning... and cuz everyone else has gone home already the kitchen is locked and i cant make coffee
anywho, thanx for the help
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Its always np to help you, not saying your questions are always simple, but you ask them correctly, use PRE tags and don't type like a 13 year old. Refreshing to see
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Phannon wrote: you ask them correctly
yeah, took the time to read the rules may that be a lesson for the rest of yall
Phannon wrote: don't type like a 13 year old
mayb cuz im a 19 year old
thanx again for the help, i duno what id do without you guys at CP... fall WAY behind on my deadlines
im going home now, its 7pm here in South Africa and ive been at work since 6am
cheerZ
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
StatusStrip don't process mouse clicks if parent window is inactive.
I have an application with two winforms, one which has a StatusStrip object. The StatusStrip object has a couple of buttons with mouse click handlers hooked up.
If the window with the status strip is the active window, the mouse click handler get called when user clicks on a button on the status strip.
If the window with the status strip is not the active window, it takes two click on a status bar button to get the mouse click handler called. The first click only activates the window and do not result in a call to the click event handler.
Anyone knows how to fix this? How to get a status strip to fire events even if it is in a nonactive window so user don't have to click twice?
|
|
|
|
|
Hello, all you smart people.
Short version:
In Visual Studio 2005, the 'Data' menu item at the top of the screen keeps disappearing after I attempt to show the existing data sources, or add a new data source. Any ideas?
Long version:
I'm encountering a rather frustrating issue in Visual Studio 2005, SP1. I am creating a Visual C# ASP.NET Web application, and I want to add a Data Source to the project. Now, when I first create the application, the 'Data' menu is available at the top of the screen, with the two sub-menu items 'Show Data Sources' and 'Add New Data Source'. The respective icons also appear in the Data Design toolbar.
However, when I click the 'Show Data Sources' icon, or the 'Show Data Sources' menu item, the Data menu item disappears, and the Data Design toolbar icons become disabled. No matter what I try, I can't get the Data menu item to re-appear. If I completely shut down VS 2005, then launch it again, the Data menu is back. But the same behavior exists (i.e., it disappears if I try to use it). Similarly, if I click the 'Add New Data Source', I am allowed to go through the process of adding the data source. But when I am done with that process, the Data menu makes a hasty exit, and I can't even view the data source I allegedly created.
Any idea what is happening, here? As far as I know, my installation is fine. This does not appear to be the issue of the 'Data' menu disappearing when the context of programming calls for it to disappear (for example, when editing code).
My Google-Fu has failed me on this issue, so I am calling out the big guns (RE: this forum). Thank you in advance to any and all those who read this, and a special thank you to those who respond.
modified on Wednesday, March 19, 2008 12:33 PM
|
|
|
|
|
packmichael wrote: Visual Studio 2004
Must have missed that release.
only two letters away from being an asset
|
|
|
|