Jump to content


Check out our Community Blogs

yoda174

Member Since 18 May 2010
Offline Last Active May 18 2011 12:10 PM
-----

Topics I've Started

C# checkbox problem

20 June 2010 - 04:56 AM

Dear members!

I created a lanchat program. I want to make a settings section. I designed it in a new form that called settings and i put on the settings form one checkbox.With this checkbox I want to start in the main form one automatic logging timmer what log into one file the chat,i can start the autosave and it work fine:) but ever when close the settings form and i reopen the settings form the checkbox state is unchecked:cursing:,vainly checked it before closing and reopening:cursing:

my source code what check the autostart timer state on the form1 and "enable/disable" the checkbox
{
            InitializeComponent();
            Form1 form = new Form1();
            if (form.autosave.Enabled == true)
            {
                this.checkBox1.Checked = true;
                this.checkBox1.CheckState = CheckState.Checked;
            }
            else
            {
                this.checkBox1.Checked = false;
                this.checkBox1.CheckState = CheckState.Unchecked;
            }
        }

Any idea?

C# Remote Administration Tool

20 June 2010 - 04:06 AM

Dear Codecall members!

I want to know more about remote administration tool(how can i make one,and what function usually contains one...etc) I want use this program for good purposes and not for bad :)

If someone have a working source code(enough if have some simple function:)) I would really appreciate it.

p.s.: I tied the google but i didn't find understandable description for me...:crying:

THANX & sory for my bad English:thumbup::thumbup:

c# Tutorial : How write a password protected application.

22 May 2010 - 10:08 AM

In this tutorial i will show you what can we write an application that protected with username and password. Let's start.

First we make a project.
Then we make the design of the loging form.(we required 2 textbox that called txtUser,and txtPass, 1 checkbox, 1 button that I called btnLogin and some label.)
That's mine :
Posted Image
then we can start the designing of the main form( the main form we can see after logging in)

The code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace password_protect_application
{
    public partial class Form1 : Form
    {
        Form2 mainform = new Form2();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //the checking method
            //you can put into the bracket the password,and username what you want
            if (txtUser.Text.ToString().CompareTo("test") == 0 & txtPass.Text.ToString().CompareTo("test") == 0)
            {
                MessageBox.Show("Login Sucessfull.Click OK to continue", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();     //hide the login form
                mainform.Show(); //& show the main form 
            }
            else
            {
                MessageBox.Show("Wrong Username/Password! \n Please try again!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPass.Text = ""; //delete writed password
                txtUser.Text = ""; //delete writed username
            }
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
            {
                txtPass.PasswordChar = '*'; //set passwordchar to '*'
                checkBox1.Text = "Show password"; //change checkbox text to show password
            }
            else 
            {
                txtPass.PasswordChar = (char)0; //reset passwordchar to default
                checkBox1.Text = "Hide password"; //change password to hide password
            }
        }

    }
}


This source code content a password hide/show function also :)
I Hope that it was very helpfull and if you have any question or problem please ask me and i reply:)

P.S : Sorry for my bad English but I live in Hungary and english isn't my mother language.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download