Jump to content


rafael200

Member Since 30/11/2011
Offline Last Active 13/12/2011, 17:05
-----

Topics I've Started

Contar Registros

03/12/2011, 12:26

Boa Tarde...

Eu estou fazendo um programa e gostaria de saber, como se faz o seguinte:

Segue a imagem do form:
Attached File  imagem.png   9.19KB   3 downloads
Gostaria de fazer por exemplo:
o 1º radiobutton a resposta esta certa.
e assim por diante,
com ate 3 forms...
e na 3ª form, ele contabilizar as respostas certas: 4 certas e erradas: 3 erradas e soma as duas e tirra a media, fazendo um if, de aprovado e reprovado.
é possivel fazer isto?

Obrigado pela atenção.

Area De Login Com Cadastro De Usuários.

30/11/2011, 18:31

Boa Tarde...

Eu estou desenvolvendo uma aplicação e gostaria de saber, se é possível fazer um cadastro onde que o usuário cadastre e depois ele loga com o usuário cadastrado.
Se precisar segue o código, se tiver certo:
Este é do formulário de login.
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;
using System.Data.SqlClient;

namespace Sistema_e_Learning_Advanced_Plus
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void lblCad_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            CadastroUsuario cser = new CadastroUsuario();
            cser.Show();
        }

        private void btnAcessa_Click(object sender, EventArgs e)
        {
            frmPrincipal princ = new frmPrincipal();
            SqlConnection con = new SqlConnection("Data Source = Nome-PC\\SQLEXPRESS; Initial Catalog = table; Integrated Security = true;");
            SqlDataAdapter da = new SqlDataAdapter("SELECT Usuario, Senha FROM dbo.CadUser", con);
            con.Open();
            if (txtUser.Text == "")
            {

                da.SelectCommand.CommandText = txtUser.Text;
            }
            else if (txtPass.Text == "")
            {
                da.SelectCommand.CommandText = txtPass.Text;
            }
            else
            {
                MessageBox.Show("Bem Vindo Usuário.");
            }

           
        }
    }
}

este é do cadastro de usuários.

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;
using System.Data.SqlClient;

namespace Sistema_e_Learning_Advanced_Plus
{
    public partial class CadastroUsuario : Form
    {
        public CadastroUsuario()
        {
            InitializeComponent();
        }

        private void btnCad_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source = Nome-PC\\SQLEXPRESS; Initial Catalog = table; Integrated Security = true;");
            SqlCommand cmd = new SqlCommand("INSERT INTO dbo.CadUser VALUES(@usuario, @Senha)", con);
            con.Open();
            try
            {
                cmd.Parameters.AddWithValue("@Usuario", txtUser.Text);
                cmd.Parameters.AddWithValue("@Senha", txtPass.Text);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Usuário e/ou Senha Incorreta!" + ex);
            }
            finally
            {
                cmd.ExecuteNonQuery();
                con.Close();
            }
        }
    }
}


Obrigado pela atenção.

IPB Skin By Virteq