Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Deresen

@Deresen
About
Posts
136
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Threading
    D Deresen

    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.

    C# question

  • Call event in another event
    D Deresen

    You 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
    }

    C# help question

  • Stop while loop
    D Deresen

    I'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.

    C#

  • Stop while loop
    D Deresen

    Problem 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

    C#

  • read grayscale image
    D Deresen

    What would you like to do? Convert an image from color to grayscale? Or something else?

    Visual Basic

  • Show Image on webpage
    D Deresen

    Thank 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();
    
    ASP.NET

  • Show Image on webpage
    D Deresen

    Hey 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.

    ASP.NET

  • How to catch browser close
    D Deresen

    If 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.

    C#

  • ReadLine, Perform Action, DeleteLine, ReadNextLine...
    D Deresen

    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.

    C#

  • How to catch browser close
    D Deresen

    First: 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>

    C#

  • Using Visio 2007
    D Deresen

    If you just want to draw charts you can 1. make your own library 2. use an external library. You could use Dundas Charting (you've got to pay for this) or you can use something like this: charts[^]

    C#

  • Using Visio 2007
    D Deresen

    I 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:

    C#

  • Searching words in a matrix
    D Deresen

    I 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.

    C# css game-dev algorithms question learning

  • start text from required word
    D Deresen

    d@nish wrote:

    spoon feeding

    Lol :laugh:

    C# database algorithms question

  • Please help me to write a program to simulate a bookstore in java
    D Deresen

    Allright:

    boolean noobIsProgramming = true;

    public void example()
    {
    if(noobIsProgramming)
    {
    destroyComputerIn10Seconds();
    }
    }

    Java java design help tutorial question

  • dynamically displaying an image in a menu?
    D Deresen

    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.

    C# question help

  • Please help me to write a program to simulate a bookstore in java
    D Deresen

    No 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:

    Java java design help tutorial question

  • start text from required word
    D Deresen

    WTF, FTW? :wtf:

    C# database algorithms question

  • start text from required word
    D Deresen

    You'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?!?

    C# database algorithms question

  • Threading in C# with a Console Application
    D Deresen

    You 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

    C# csharp java help question learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups