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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
B

bar3000

@bar3000
About
Posts
20
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Invalid IP
    B bar3000

    Thanks, used IPAddress.TryParse() worked fine for me.

    C#

  • Invalid IP
    B bar3000

    Hi, I built an application using a TCP/IP connection. Therefore I need an I.P. checker to make sure the given IP is correct. I noticed that when an invalid IP is provided the complier can tell it right away. SO my quesion is if there is a command to check if an IP address is valid. By valid I mean it is less than 255.255.255.255. Or if you happen to have a code that does it i would be greatful. Thank you in advance :)

    C#

  • Transfer a txt file
    B bar3000

    I don't know the destination file. he user desides where he wants to save it with the save dialog.

    C# game-dev

  • Transfer a txt file
    B bar3000

    the statements in the if clause close a different stream. The one which i want to open with the new stream. Google came up with FileStream fs = new FileStream(@"C:\Documents and Settings\Bar\My Documents\savegame.txt", FileMode.Open); for opening txt files.

    C# game-dev

  • Transfer a txt file
    B bar3000

    Hi, I am trying to transfer a txt file by loading it and saving it with a save file dialog.

    SaveFileDialog saveDialog = new SaveFileDialog();
    saveDialog.AddExtension = true;
    saveDialog.FileName = "Checkers Game";
    saveDialog.InitialDirectory = @"C:\Documents and Settings\Bar\My Documents\";
    saveDialog.OverwritePrompt = true;
    saveDialog.Title = "Save game";
    saveDialog.ValidateNames = true;
    saveDialog.ShowDialog();
    if (saveDialog.FileName != "")
    {
    writer.Close();
    file.Close();
    FileStream fs = new FileStream(@"C:\Documents and Settings\Bar\My Documents\savegame.txt", FileMode.Open);
    fs = (System.IO.FileStream)saveDialog.OpenFile();

            }
    

    but when i go to the saved file i get an empty file even though the text i loaded isn't empty. Thanks:)

    C# game-dev

  • Saving and loading a file
    B bar3000

    Hi, I am building a checkers game and I would like to have an option of saving and loading the game. I need to save the game state meaning pictureboxes, arrays, stacks etc... I would be glad to be directed to some article that explains how this could be done. Thank you:)

    C# game-dev

  • Radio Buttons
    B bar3000

    Thank you, But I managed to figure it out by myself:) makes me pround:D

    C#

  • Radio Buttons
    B bar3000

    Hi, I wanted to know if there is any way to call a method from just clicking a radio button without having to click on an apply button. Thank you:)

    C#

  • How to enable auto scroll in a listbox?
    B bar3000

    Thanks helped me a lot

    C# tutorial question

  • How to enable auto scroll in a listbox?
    B bar3000

    didn't quite catch that... can u be more specific with the code?

    C# tutorial question

  • How to enable auto scroll in a listbox?
    B bar3000

    I have a list box in my app and i want it to autoscrol downward so it would always show the last item added. Thank you:)

    C# tutorial question

  • Timer
    B bar3000

    I lost you guys... But I'll try to find some book about it. Thanks anyway:)

    C# graphics tutorial

  • Timer
    B bar3000

    Intresting, but I'd be delighted if you could give me some more detailed code because I am a real noob in C#. Thank you:)

    C# graphics tutorial

  • Timer
    B bar3000

    I should have mentioned the fact that the picturebox may change and it does not necessarily change it's x coordinate by a constant value. It may also changes its y value.

    C# graphics tutorial

  • Timer
    B bar3000

    Hi, I would like to excute a command after a certain period of time, for instance 1 sec. For Example: pictureBox78.Location = new System.Drawing.Point(460, 360); 1 sec interval pictureBox78.Location = new System.Drawing.Point(560, 360); 1 sec interval pictureBox78.Location = new System.Drawing.Point(660, 360); 1 sec interval pictureBox78.Location = new System.Drawing.Point(760, 360); and so on... Thanks in Advance:)

    C# graphics tutorial

  • string question
    B bar3000

    I have a string with the value of "pictureBox89", a picturebox who's called pictureBox89, and another picturebox called picbox. Now when I recieve the "pictureBox89" string is there any way I can make picbox equal pictureBox89? I thought about If( a == "pictureBox89") picbox = pictureBox89; but the thing is I have too many pictureboxes. I figured if there's a command for this I could get it over with in one line. Thanks in advance.

    C# question

  • windows forms TCP connection problem
    B bar3000

    Thank you very much! finaly worked it out...

    C# help tutorial csharp winforms game-dev

  • windows forms TCP connection problem
    B bar3000

    can u give the line for this please.. because when i try Thread tcp = new Thread(new ThreadStart(getTcpStream)); it gives me this error Error 1 'System.IO.Stream WindowsFormsApplication1.Form1.TCPChatApplication.getTcpStream()' has the wrong return type

    C# help tutorial csharp winforms game-dev

  • windows forms TCP connection problem
    B bar3000

    do I need a reader thread too then?

    C# help tutorial csharp winforms game-dev

  • windows forms TCP connection problem
    B bar3000

    Hi, I built a checkers game in C# in which players sitting next to each other can play. I am now trying to upgrade it, to become internet based. I want to generate a simple P2P connection. I wrote this code to see if a connection is established but for some reason it freezes when pressing the connection button. Please help me sort this out. Or if you think this code is unsuitable, than please help me out with this.. here is the code

        string clientOrServer;
        Stream \_stream;
        string read;
            Stream getTcpStream()
            {
            TcpClient client;
            IPEndPoint meetingPoint = new IPEndPoint(IPAddress.Parse("79.178.57.135"), 8080);
            if(clientOrServer.ToLower().StartsWith("c"))
                {
                    client = new TcpClient();
                    client.Connect(meetingPoint);
                }
                else
                {
                    TcpListener listener = new TcpListener(meetingPoint.Port);
                    listener.Start();
                    client=listener.AcceptTcpClient();
                    listener.Stop();
                }
                return client.GetStream();
            }
      
        void clientServerclick(System.Windows.Forms.PictureBox picturebox)
        {
           StreamWriter writer = new StreamWriter(\_stream);
           writer.AutoFlush = true;
          if (picturebox == pictureBox89)
          {
              writer.WriteLine("{0}", pictureBox89);
          }
          if (picturebox == pictureBox51)
          {
              writer.WriteLine("{0}", pictureBox51);
          }
        }
        void readclick()
        {
            StreamReader reader = new StreamReader(\_stream);
            string a = reader.ReadLine();
            Console.WriteLine(a);
        }
    

    this is the code for client generating connection
    clientOrServer = "c";
    _stream = getTcpStream();
    Console.WriteLine("Connected");
    server
    clientOrServer = "s";
    _stream = getTcpStream();
    Console.WriteLine("Connected");
    this runs when a click on a soldier occurs
    clientServerclick(pictureBox);

    If this code is off, please guide me on how to accomplish this sort of thing.THANKS :-D :)

    C# help tutorial csharp winforms game-dev
  • Login

  • Don't have an account? Register

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