Many thanks for your help ddanbe!

Much appricated!

Ah, Found the issue.. I was using 'LowerCase' "mm" for the Month insted of "MM"..

Do you know the reason behind this?

Hi ddanbe,

Many thanks for your response!

I think I'm nearly there. However the Month is not showing up? Please see screenshots attached.

the DataSet seemsto be filled with the correct info.. Just the way the form is displaying.

Any ideas?

Click HereHI @ddnabe.. Thanks for your reply..

I have looked into this and I've also read that I should be able to Config Each column Accordingly.

I'm Currently using this piece of code:

        //Change the Headers on the DataGridView2//
                dataGridView2.Columns["cashQTY"].HeaderText = "QTY";
                dataGridView2.Columns["cashDescription"].HeaderText = "DESCRIPTION";
                dataGridView2.Columns["cashSupplier"].HeaderText = "SUPPLIER";
                dataGridView2.Columns["cashDate"].HeaderText = "DATE";
                dataGridView2.Columns["cashCost"].HeaderText = "COST (£)";
                dataGridView2.Columns["cashSell"].HeaderText = "SELL (£)";

                //Trying to for change of "casDate" to a type of DateTime//
                this.dataGridView2.Columns["cashDate"].ValueType = typeof(DateTime);

Currently it does not error, but it also does not Show the DateTime in the GridView when running either..

Currently stepping through it to see what happens.

Any ideas guys?

Hi Guys, I've been playing around with this.. and I assume I have to convert this particular data.

I know its DGV releated and when I run the Export to Excel routine from the system it shows the date correctly.

Anyone got any ideas on this please?

Do I need to 'Convert' the particular Column

Click HereAh.. It looks like I spoke to soon guys...

Due to their being a 'Date Format' within the GridView its now coming up with 'N2' instead of the Date.

How can I filter out this column? (Attached Screenshot).

Also Below is the snippet of Code I'm currently using. When a user select the account from the DGV1 it will pull up the corresponding Orders in DGV2 via the ODBC Connection.

  private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //If the Radio Button is checked the Script between the {} will be run//
            if (radioButton1.Checked == true)
            {
                //Looks at the row Selected in the GridView and then takes the Account Number and Stores in a Int64 called 'Customer ID'//
                DataGridViewRow drow = dataGridView1.SelectedRows[0];
                //Int64 CustomerID = Convert.ToInt64(drow.Cells[0].Value);
                string CustomID = Convert.ToString(drow.Cells[1].Value);

                //Sets the Selected Account and shows inside the Text Boxes on the right-hand side of the screen//
                txtAccRef.Text = dataGridView1.SelectedCells[1].Value.ToString();
                txtAccName.Text = dataGridView1.SelectedCells[2].Value.ToString();
                txtAccAddr1.Text = dataGridView1.SelectedCells[3].Value.ToString();
                txtAccAddr2.Text = dataGridView1.SelectedCells[4].Value.ToString();
                txtAccTown.Text = dataGridView1.SelectedCells[7].Value.ToString();
                txtAccPostCode.Text = dataGridView1.SelectedCells[6].Value.ToString();
                txtAccCounty.Text = dataGridView1.SelectedCells[5].Value.ToString();

                //Message to Test ID has been stored//
                //MessageBox.Show("Customer ID Stored");

                //Creates new versions of the Connection string and Data Set//
                con = new System.Data.OleDb.OleDbConnection();
                ds3 = new DataSet();

                //The actual connection to the database//                               //XML Path to Data Base held in string...sneaky like a Ninja!//
                con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" + textBox1.Text.ToString();

                //The SQL String you need to pass into the Data Adapter to collect the information//
                string OrdersCashCustomerSQL = "SELECT cashID, cashQTY, cashDescription, cashSupplier, cashDate, cashCost, cashSell, CashAccountRef_FKID from cashOrders ...

Sorry Guys,

Found the answer. Was able to go into the Gridview and change the properies to show 2 Decimal Places..

Thank you anyways.. Hope this helps someone else out!

Hi Guys,

If you have a Text Box which you are putting in the Decimal Places such as "15.50". Then Submitting this to a Access Database then on re-fresh the data shows in the grid view as "15.5". Where abouts should this be modified so that it shows Decimal Places?

Is it on the Access DB Layout and how it's store or should there be come amendment on the code side? It looks like the GridView is removing the trailing '.00's' ??

Many thanks for any help.

Hi Fenrir()

Thank you for your help on this but I've managed to figure out what was going on.. Talk about Newbie mistakes...

I had my DataSets all other the place.. and when 1 was being filled another was being wiped on a differnet event. then it would not find the customer details..

Managed to clean them up and add a few more new ones to get around the issue.. Little bit messy but have noted all the code.

Thanks for your help! :)

Thought of another way around this issue.

Is there a way that I can re-populate the DGV with a DataSet when Text box is empty? and dependant on what RadioButton is selected?

Hi Fenrir() Thanks for your reply.

I'm currently stepping through it and I think the issue lies when selecting the filtered result from the DGV and it goes off a collects data from the table and populates the text fields.. It also then does a look up for any related Order Lines and populates a secondary grid view below (IF) any are found.

I THink Its to do with a DataSet I have called DS4 (Which hold account detailed pulled in from Line 50).

Looking at the Search Result that works.. it uses a DataSet called DS and that does not seem to be affected in the same way..

It's a tricky one... :S

Hi Guys...

Slight update on this... The Above code acutally seems to work?! Oddly..

However, the code below does not. (I have 2 differnet connection types.. 1 Links to Sage Line 50 and the other connects to a MDB Database). These are selected depending on the radio button selected and the DataSet Populated.

  private void textBox2_TextChanged(object sender, EventArgs e)
        {

            //Below Searches on the Cash Accounts DataSet for Matching Accounts.
            if (radioButton1.Checked == true)
            {
                DataView DV = new DataView();

                DV.Table = ds.Tables["cashCustomers"];
                DV.RowFilter = "CashAccRef LIKE '%" + textBox2.Text + "%' OR CashName LIKE '%" + textBox2.Text + "%' ";
                dataGridView1.DataSource = DV;
            }

            //Below Searches on the Line50 Accounts DataSet for Matching Accounts.
            else if (radioButton2.Checked == true)
            {
                DataView DV = new DataView();

                DV.Table = ds4.Tables["ACCOUNTS"];
                DV.RowFilter = "ACCOUNT LIKE '%" + textBox2.Text + "%' OR NAME  LIKE '%" + textBox2.Text + "%' ";
                dataGridView1.DataSource = DV;
            }
            //Below Searches on the Line50 Accounts DataSet for Matching Accounts.
            else if (radioButton3.Checked == true)
            {
                DataView DV = new DataView();

                DV.Table = ds4.Tables["ACCOUNTS"];
                DV.RowFilter = "ACCOUNT LIKE '%" + textBox2.Text + "%' OR NAME  LIKE '%" + textBox2.Text + "%' ";
                dataGridView1.DataSource = DV;
            }
        }

The 'Line 50' Accounts DataSet is the one that is causing the Issue. But I cannot seem to see any difference between the code working and the code that does not work?

Thanks guys..

Hi Guys, I hope you can help me out...

I have a slight issue in where the 'Search Box' Code I currently have seems to sift through the Populated Data Grid View fine. However, when selecting an Account that has been filtered by the use off the 'Search Box' it correctly populates the TextBoxes but when clearing the 'Search Box' it then removes the data in the Grid view below which I don't want.

My question is, How do I stop this from happening? I want to keep the DGV Populated to re-use again. I have attached screenshots of the program.

Capture1.jpg - Shows the Populated DGV with a Customer Search Box above.
Capture2.jpg - Filtering the list to show the perferred account.
Capture3.jpg - Clicking on the Filtered Account which in turn populates the Text Boxes on the left.
Capture4.jpg - When 'Backspacing the data in the search box' the DGV below is empty?

Below is the Code Block Currently Being used (Beginner here writing code...)

    private void textBox2_TextChanged(object sender, EventArgs e)
        {

            //Below Searches on the Cash Accounts DataSet for Matching Accounts.
            if (radioButton1.Checked == true)
            {
                DataView DV = new DataView();

                DV.Table = ds.Tables["cashCustomers"];
                DV.RowFilter = "CashAccRef LIKE '%" + textBox2.Text + "%' OR CashName LIKE '%" + textBox2.Text + "%' ";
                dataGridView1.DataSource = DV;
            }
        }

Hope you guys can help and this is driving me nuts!

Thanks in advance! I've learnt a lot from DaniWeb.

Looks like I'm getting this error when attempting to Convert?

Thanks ddanbe, for your response.

Are you able to provide me with an example how it would be used in the above code?

Regards
Mar

Hi Guys,

Hope you can help. (Bit of a N00b still).. I've written an Functioning Program (Good start!)

However, I was wondering if there is a way for the data that is being shown currently in the Grid view to be shown with 'Decimal Places? The Data is Being pulled in via ODBC from a Access DB. The Table Column has been setup as 'DataType' = Currency with Decimal Places Defaulted to '1'.

When looking at the data in the DB the Decimal Places are in the correct place but when pulling the data via ODBC into the GridView it does not show.

Currently code looks something like this:

//Tells the dataGridView to load with the information stored in table called 'cashCustomers' in the DataSet (DS)//
                dataGridView2.DataSource = ds3.Tables["OrdersCashCustomers"];

                //Change the Headers on the DataGridView2//
                dataGridView2.Columns["cashQTY"].HeaderText = "QTY";
                dataGridView2.Columns["cashDescription"].HeaderText = "DESCRIPTION";
                dataGridView2.Columns["cashSupplier"].HeaderText = "SUPPLIER";
                dataGridView2.Columns["cashDate"].HeaderText = "DATE";
                dataGridView2.Columns["cashCost"].HeaderText = "COST";
                dataGridView2.Columns["cashSell"].HeaderText = "SELL";

                //Hide Columns on DataGridView2//
                dataGridView2.Columns["cashID"].Visible = false;
                dataGridView2.Columns["CashAccountRef_FKID"].Visible = false;

            }

            else if (radioButton2.Checked == true)
            {
                //Looks at the row Selected in the GridView and then takes the Account Number and Stores in a String Value called 'Customer ID'//
                DataGridViewRow drow = dataGridView1.SelectedRows[0];
                String CustomerID = Convert.ToString(drow.Cells[0].Value);

                //Pulls Across the Account number so the Orders for Accounts can be joined//
                txtAccRef.Text = dataGridView1.SelectedCells[0].Value.ToString();
                txtAccName.Text = dataGridView1.SelectedCells[1].Value.ToString();
                txtAccAddr1.Text = dataGridView1.SelectedCells[3].Value.ToString();
                txtAccAddr2.Text = dataGridView1.SelectedCells[4].Value.ToString();
                txtAccTown.Text = dataGridView1.SelectedCells[2].Value.ToString();
                txtAccCounty.Text = dataGridView1.SelectedCells[5].Value.ToString();
                txtAccPostCode.Text = dataGridView1.SelectedCells[6].Value.ToString();

I'm Sure I need to 'Convert.ToInt32' or something like that.. But I'm not really to ...

Hi Guys...

looking for a quick answer on excel Formula..

Anyone know why my text "Please Chase" is not showing up?

=IF(ISNUMBER(F2),$F2>TODAY(),"Please Chase")

Hi Mikey,

Yes and Yes.. Sorry "Blonde Moment" All sorted now. Thank you.

Yeah,

That's what I tried but I get the following error?

"Error 1 Cannot implicitly convert type 'System.Windows.Forms.DataGridViewAutoSizeColumnMode' to 'System.Windows.Forms.DataGridViewAutoSizeColumnsMode'. An explicit conversion exists (are you missing a cast?)"

Hi Mikey,

I've had a play and I'n not to sure how to impliment it within my code as I've never used it before...

Here is what I have so far..

  //Displays the Wanted Data in Grid View//
            dataGridView1.DataSource = ds.Tables["VPN"];

            dataGridView1.Columns["VPN_ID"].Visible = false;
            dataGridView1.Columns["companyName"].Visible = true;
            dataGridView1.Columns["vpn_IP"].Visible = false;
            dataGridView1.Columns["Domain"].Visible = false;
            dataGridView1.Columns["vpn_Username"].Visible = false;
            dataGridView1.Columns["vpn_Password"].Visible = false;

            dataGridView1.Columns["companyName"].HeaderText = "Company Name";

Hi Guys,

OK, i've been through nearly all the properties possible in VS2010 to try and find how to do this most basic of tasks.

Look at Screenshot 25... This is how it shows at the moment.

Now look at Screenshot 26... This is How I WANT it too look but every property i try it does not fill to DGV!?

Any ideas?

Regards
Mark.

Thanks Ketsue, I will try this out.

Hi Guys,

I have a Dataset which has been populated correctly now (after a bit of a blonde moment earlier).

I've decided to go for a ComboBox Drop-Down option which currently is showing the "companyname" Column of the DataSet.

However, How do I go about Getting Text boxes to To populate with the relevent information from the Company that has been selected in the 'ComboBox' ? (If that makes sense?)

For Example:
Company 1 selecting in the ComboBox.

Text Boxes below need to populate with that Companies Details.

Thanks for your help.

Regards
Mark.

God.. I'm an idiot.

I had the DB passworded. Slaps self

Sorry for wasting your time guys.. This has resolved itself now.

Just out of curiosty is it possible to put a 'password' into the connection string of a ACCDB?

Nope... Still nothing..

When debugging it gets to con.open();

and then just opens without completing the rest of the code.

           //Creates new versions of the Connection string and Data Set//
            con = new System.Data.OleDb.OleDbConnection();
            ds = new DataSet();

            //Opens the connection//

            //The actual connection to the database//
          con.ConnectionString = "PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source=C:\vpn_db.accdb";

            con.Open();
            da = new OleDbDataAdapter();
            da.SelectCommand = new OleDbCommand("select * from VPN", con);
            da.Fill(ds);
            con.Close();

        } 
    }
}

Hi Ketsue,

I've trouble shot this a bit and I think it's something to do with the connection string for some reason.

Won't even let me access it if I hard-code the location of the accdb.

Is there a profiler built in to VS2010?

Hi Ketsuekiame, Thanks for your reply.

Do'h.. Yes I've done that but still same problem, :S

Hi Guys...

Putting together a Tiny little app which shows VPN Details for use 'In-House' but for some strange reason my DataSet won't fill?

Can anyone spot the mistake? :S

        private void Form1_Load(object sender, EventArgs e)
        {

       //XML Load of Document. This loads the XML Document and the value of a Single Node then inputs this to a text box//
            XmlDocument doc = new XmlDocument();
            doc.Load("C:\\vpn.xml");
            XmlNode node = doc.SelectSingleNode("/DataBases/VPN_Access/vpn_DB");
            this.txtBoxDebug.Text = node.InnerText;

            //Creates new versions of the Connection string and Data Set//
            con = new System.Data.OleDb.OleDbConnection();
            ds = new DataSet();

            //The actual connection to the database//
            con.ConnectionString = "PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source =" + txtBoxDebug.Text.ToString();

            //The SQL String you need to pass into the Data Adapter to collect the information//
            string vpnDetails = "SELECT * FROM VPN";
            da = new System.Data.OleDb.OleDbDataAdapter(vpnDetails, con);

            //The Data Adapater (da) is told to fill the DataSet (ds) with the information pulled from the SQL Query and call this fill "cashCustomers"//
            da.Fill(ds, "VPN");

            //Opens the connection//
            con.Open();

            //Closes The Connection//
            con.Dispose();

            //Tells the dataGridView to load with the information stored in table called 'cashCustomers' in the DataSet (DS)//
            dataGridView1.DataSource = ds.Tables["VPN"];

Many thanks for your help.
Mark.