Well, you can have a single thread running. This means you have 'some code' + a 'thread', with multithreading you have several threads running paralel to each other, like this: 'some code' + a 'thread' + a 'thread' etc. So you can say single threading is just one thread.
Deresen
Posts
-
Threading -
Call event in another eventYou can replay a cd, not a post :). But to call events like you would like, you have to call it just like a function:
public void Button1_Clicked(object sender, EventArgs e)
{
//do some stuff//do some stuff the same as button2
Button2_Clicked(sender, e);
}public void Button2_Clicked(object sender, EventArgs e)
{
//do some stuff
}To be honest: this is not really neat. To make it more beautifull, you should just make a function like this:
public void Button1_Clicked(object sender, EventArgs e)
{
//do some stuff//do some stuff the same as button2
doStuffFromButton2();
}public void Button2_Clicked(object sender, EventArgs e)
{
//do some stuff
doStuffFromButton2();
}public void doStuffFromButton2()
{
//do some stuff
} -
Stop while loopI've never used the Application.DoEvents() function. Didn't even know the existance of it. With that in my mind, I totaly agree with you.
-
Stop while loopProblem with this is that there won't be any click events, because it won't check this. You can better use a thread and in this thread you put your code. Something like this (out of my head):
private bool _running = true;
public static void main(args[])
{
Thread t = new Thread(threadFunction);
t.Start();
}public void threadFunction()
{
while(_running)
{
// your stuff here;
}
}public void Button1_Clicked(object sender, EventArgs e)
{
_running = false;
}Don't know if the 'thread' part is correct, the rest is ok ;P
-
read grayscale imageWhat would you like to do? Convert an image from color to grayscale? Or something else?
-
Show Image on webpageThank you for your response. Though the anwser has been given to me by my colegue. It's like this: backend page 1:
Image1.ImageUrl = "GetImage.aspx?id="
backend page 'getImage.aspx':
int number = int.Parse(Page.Request.QueryString.Get("id"));
Bitmap b = makeImageByNumber(number);
//Set the Responsetype Response.ContentType = "image/jpeg"; //Save the dynamicly generated bitmap to the OutpuStream b.Save(Response.OutputStream, ImageFormat.Jpeg); //End we're done. Response.End();
-
Show Image on webpageHey all, In my backend (code), i've got a Bitmap, which I've filled with some pixels. Now I want to show this image on an aspx page. Does anyone has any idea how to solve this problem. I've tried , but this needs an url. I Also tried but this also needs an url.
-
How to catch browser closeIf your question is 'how can I detect press close button on the browser' you should question that in stead of 'how to catch browser close'. And maybe I've allready given you the anwser: <body onload="LoadMe()"> I even wrote an implementation for you, but you're probably not interested in that.
-
ReadLine, Perform Action, DeleteLine, ReadNextLine...To do this, you have to do something like this:
while(true)
{
StringBuilder wholeText = "";
String fileName = "file.txt";
// create reader & open file
Textreader tr = new StreamReader(fileName);// read a line of text
String oneLine = tr.ReadLine();
if(oneLine == null)
{
break;
}
else
{
doSomethingWith(oneLine);
}while(String s = tr.ReadLine != null)
{
wholeText.add(String.Format("{0}\n",s);
}
// close the stream
tr.Close();//open the same file and write the text in there
Textwriter tw = new StreamWriter(fileName);
tw.write(wholeText.ToString());
tw.Close();
}This isn't tested, but the methodoligy should work.
-
How to catch browser closeFirst: this is no javascript forum Second: search on google for an anwser Third: here you go:
<head>
<script language="javascript">
<!--
function LoadMe()
{
self.close();
}
// -->
</script>
</head><body onload="LoadMe()">
<div align="center"><a href="javascript:window.close()">Close</a>
</div>
</body> -
Using Visio 2007 -
Using Visio 2007I don't think so, it's like getting on a train where you didn't buy a trainticket. If the app doesn't work, try the 'try-catch' method around the area's where you are trying to do something with the visio files. edit: wtf... I wrote around with a T, I'm soo ashamed of myself :wtf:
-
Searching words in a matrixI can understand this code is slow :P. But I don't really get what you want to achieve? Can you maybe clearify that? Is it like a snake? which will check for a word like this: {a, b, c} {d, e, f} {h, i, j} and if you try the word 'abf' it will find it and starts at point 0,0 and ends at 2,1. But if you try 'abj', it won't find anything? If it is, I think it is funny and I'll try to code it :D, if it isn't please explain how and what you mean exactly.
-
start text from required wordd@nish wrote:
spoon feeding
Lol :laugh:
-
Please help me to write a program to simulate a bookstore in javaAllright:
boolean noobIsProgramming = true;
public void example()
{
if(noobIsProgramming)
{
destroyComputerIn10Seconds();
}
} -
dynamically displaying an image in a menu?Well, I don't have my VS in front of me, so I'll do it out of my head. There are several possibility's. I think you should do something like this: In your code, make a function like this:
String[] imagePaths = {"mypic1.jpg", "mypic2.jpg", "mypic3.jpg"};
public void clearMenuItemImages()
{
mi1.Image = null;
mi2.Image = null;
mi3.Image = null;
}public void onMenuItem1Clicked(object sender, EventArgs e)
{
clearMenuItemImages();
((ToolStripMenuItem)sender).Image = imagePath[0];
}//etc.
You can make this faster and better, but this is a start.
-
Please help me to write a program to simulate a bookstore in javaNo problem, I'll make this for you. You can pay me by paypal, I think $950 USD will be enough for this program. Some people... to lazy to learn at school :thumbsdown:
-
start text from required wordWTF, FTW? :wtf:
-
start text from required wordYou've asked this question a few days ago: http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2980432[^] Still you can't explain what your problem is? If you want an anwser, please tell us what is it what you want to do?!?
-
Threading in C# with a Console ApplicationYou can use the namespace System.Threading for this. The same as you use threading in java, you can use it in C#.
class ThreadTest
{
static void Main()
{
Thread t = new Thread (WriteY);
t.Start(); // Run WriteY on the new thread
while (true) Console.Write ("x"); // Write 'x' forever }static void WriteY()
{
while (true) Console.Write ("y"); // Write 'y' forever
}
}To stop the thread, use t.Stop(); Or you can sleep inside the thread with Thread.Sleep(1000);//one second Good luck