Click here to Skip to main content
15,919,613 members
Home / Discussions / C#
   

C#

 
AnswerRe: Wpf frameworks or styles Pin
Gerry Schmitz29-Mar-18 6:55
mveGerry Schmitz29-Mar-18 6:55 
QuestionHow to print a recording Pin
ago248628-Mar-18 23:31
ago248628-Mar-18 23:31 
AnswerRe: How to print a recording Pin
OriginalGriff28-Mar-18 23:36
mveOriginalGriff28-Mar-18 23:36 
GeneralRe: How to print a recording Pin
ago248628-Mar-18 23:41
ago248628-Mar-18 23:41 
GeneralRe: How to print a recording Pin
OriginalGriff28-Mar-18 23:49
mveOriginalGriff28-Mar-18 23:49 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 0:04
ago248629-Mar-18 0:04 
GeneralRe: How to print a recording Pin
OriginalGriff29-Mar-18 0:11
mveOriginalGriff29-Mar-18 0:11 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 0:20
ago248629-Mar-18 0:20 
There is something that escapes me ...
This is the code for the form1
(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.OleDb;
using System.Data.SQLite;

namespace Acode
{
    public partial class Form1: Form
    {
        public Form1 ()
        {
            InitializeComponent ();
           
        }
        private SQLiteConnection sql_con;
private SQLiteCommand sql_cmd;
        private SQLiteDataAdapter DB;
private DataSet DS = new DataSet ();
private DataTable DT = new DataTable ();

        private void setConnection ()
{
sql_con = new SQLiteConnection (@ "Data Source = DBcode.db; Version = 3; New =; Compress = True;");
}

        private void LoadData ()
        {
            SetConnection ();
            sql_con.Open ();
            sql_cmd = sql_con.CreateCommand ();
            string CommandText = "select * from InfoCode";
            DB = new SQLiteDataAdapter (CommandText, sql_con);
            DS.Reset ();
            DB.Fill (DS);
            DT = DS.Tables [0];
            dataGridView1.DataSource = DT;
            sql_con.Close ();
        }

        private void Form1_Load (object sender, EventArgs e)
        {
            LoadData ();

        }

        private void ExecuteQuery (String txtQuery)
{
        SetConnection ();
sql_con.Open ();
sql_cmd = sql_con.CreateCommand ();
sql_cmd.CommandText = txtQuery;
sql_cmd.ExecuteNonQuery ();
sql_con.Close ();
}

        public static string randomstring (int length)
        {
            const string chars = "ABCDEFGHIJKLMNOPQRSTUVWYZ0123456789";
            Random random = new Random ();
            return new string (Enumerable.Repeat (floats, length) .Select (s => s [random.Next (s.Length)]). ToArray ());
        }
        private void btnGenerer_Click (object sender, EventArgs e)
        {
           
            lblDisplay.Text = randomstring (4);
            txtAfficPrice.Text = "100";
        }

        private void button1_Click (object sender, EventArgs e)
        {
            lblDisplay.Text = randomstring (5);
            txtAffichPrice.Text = "300";
        }

        private void button2_Click (object sender, EventArgs e)
        {
            lblDisplay.Text = randomstring (6);
            txtAffichPrice.Text = "500";
        }

       
        private void btnRegister_Click (object sender, EventArgs e)
        {
            if (lblDisplay.Text == "")
            {
                MessageBox.Show ("Please generate the code");
            }
            else
            {
                string txtQuery = "insert into InfoCode (Code, DateCode, PriceCode) values ​​('" + lblDisplay.Text + "', '" + dateTimePicker1.Text + "', '" + txtAfficePrice.Text + "')";
                ExecuteQuery (txtQuery);
                LoadData ();
                MessageBox.Show ("Registration completed successfully");
                lblDisplay.Text = "";
                groupBoxGenerer.Enabled = false;
                btnSave.Enabled = false;
                This.Refresh ();
            }
            
        }

        private void btnAdd_Click (object sender, EventArgs e)
        {
            groupBoxGenerer.Enabled = true;
            btnSave.Enabled = true;
        }

        private void exitToolStripMenuItem_Click (object sender, EventArgs e)
        {
            this.Close ();
        }

        private void codeSOLDToolStripMenuItem_Click (object sender, EventArgs e)
        {
            FrmCodeSold frmcodevended = new FrmCodeSold ();
            frmcodevendu.Show ();
            this.Hide ();
    
        }

        private void pointToolStripMenuItem_Click (object sender, EventArgs e)
        {
            FrmPointJournal pointQ = new FrmPointJournal ();
            pointQ.Show ();
            this.Hide ();
        }
    }
}
)

and I wish I could print all the recordings from there via another form
I have a faith done but with access and this faith I use SQlite but as I emphasize them I do not see the data SQlite in my data source.

GeneralRe: How to print a recording Pin
OriginalGriff29-Mar-18 0:42
mveOriginalGriff29-Mar-18 0:42 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 1:05
ago248629-Mar-18 1:05 
GeneralRe: How to print a recording Pin
OriginalGriff29-Mar-18 1:24
mveOriginalGriff29-Mar-18 1:24 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 1:27
ago248629-Mar-18 1:27 
GeneralRe: How to print a recording Pin
OriginalGriff29-Mar-18 1:36
mveOriginalGriff29-Mar-18 1:36 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 2:35
ago248629-Mar-18 2:35 
GeneralRe: How to print a recording Pin
OriginalGriff29-Mar-18 2:46
mveOriginalGriff29-Mar-18 2:46 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 4:04
ago248629-Mar-18 4:04 
GeneralRe: How to print a recording Pin
OriginalGriff29-Mar-18 4:25
mveOriginalGriff29-Mar-18 4:25 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 4:33
ago248629-Mar-18 4:33 
GeneralRe: How to print a recording Pin
ago248629-Mar-18 5:15
ago248629-Mar-18 5:15 
GeneralRe: How to print a recording Pin
ago248611-Apr-18 0:35
ago248611-Apr-18 0:35 
GeneralRe: How to print a recording Pin
ago248611-Apr-18 0:37
ago248611-Apr-18 0:37 
QuestionSerialPort DataReceived Event Read Byte ? Pin
ibrahimayhans28-Mar-18 3:28
ibrahimayhans28-Mar-18 3:28 
AnswerRe: SerialPort DataReceived Event Read Byte ? Pin
Richard MacCutchan28-Mar-18 3:54
mveRichard MacCutchan28-Mar-18 3:54 
GeneralRe: SerialPort DataReceived Event Read Byte ? Pin
ibrahimayhans28-Mar-18 4:00
ibrahimayhans28-Mar-18 4:00 
GeneralRe: SerialPort DataReceived Event Read Byte ? Pin
OriginalGriff28-Mar-18 4:17
mveOriginalGriff28-Mar-18 4:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.