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
D

dragon52

@dragon52
About
Posts
12
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DataGridViewComboboxColumn not selecting the right item
    D dragon52

    I am developing an app to manage bank transactions. Each transaction is related to a bank. I display transactions on a Datagridview control. One of the columns is defined as a combobox which contains a list of banks. Each transaction record has an accountID which should select an item in the combobox, ie showing the correct bank for that transaction. What I have done.. 1. The transactions are displayed correctly on the grid; 2. The combobox is loaded with the correct list of banks Problem.. Everything is working fine except the combobox does not show the correct bank for each transaction (ie, no item selected) Not sure the fact that I have 2 data tables is the problem. A table to load the transaction grid. Another table to load the combobox. Both data tables have a column called "account_id". Do I need to do anything else? Here is my code below Any help would be appreciated My grid is called "TransDataGridView" This code loads the combobox using data table dt_Accounts

    DataGridViewComboBoxColumn accountsComboboxColumn = (DataGridViewComboBoxColumn)TransDataGridView.Columns["Account"];
    accountsComboboxColumn.DisplayMember = "xaccountname";
    accountsComboboxColumn.ValueMember = "xaccountid";
    accountsComboboxColumn.DataSource = dt_Accounts;

    This code loads the datagrid using data table dt_Trans

    TransDataGridView.DataSource = dt_Trans;

    Visual Studio help css question

  • DataGridView, how to insert row when EnterKey pressed
    D dragon52

    Hi, I have a data bounded DataGridView control. When I have filled in a row of data on the control I want to save that data to my database table. I want to do the save by hitting the Enter key. Not using a button control. I have several questions .... 1. How do I trap/detect the Enter key? Do I use KeyPress event like this ? ...

        private void transactionstblDataGridView\_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                transactionstblTableAdapter.Insert(int,DateTime,decimal,decimal,string,int)
                {
                     ///
                };
            }
        }
    

    2. The Adapter.Insert() function in the above is created by Visual Studio. The function parameters list every column of my database table. Two of them are not needed for an Insert/Save because it is defined as auto_increment or as current DateTime (ie use as time_stamp). What do I have to do? How do I do the insert with some parameters left out. Define my own Insert function? 3. How I do detect/know which row on the DataGridView control contains the data I need to save to the database. And thinking ahead, I will do Update, Delete too using the same DataGridView control. Any help is much appreciated Thanks

    Visual Studio question csharp database visual-studio help

  • Databindings fail to update db
    D dragon52

    I stopped at tbxSchoolName_Validating and neither data nor state has changed. I stopped at tbxSchoolName_Validated and only data has changed but RowState = "Unchanged". What can happen in between these 2 events?

    .NET (Core and Framework) database help question announcement

  • Databindings fail to update db
    D dragon52

    Mika, thanks for your reply. I have done a debug as you suggested and found that the row item in question has changed (when I changed the tbxSchoolName) but the RowState remains "Unchanged". Do you know why? The test I am doing is simple enough, I display the form which loads the controls. I select a record from the Combobox which populates the Textboxes. I make a change to the Textbox. I click the 'Save' button to do the Update(). I have noticed that my changes in the Textbox 'tbxDaySchoolName' is not reflected in the Combobox 'cbxDaySchools'. I have done a search and AcceptChanges() is not used on this form any more. Obviously my 'select' command works but here is the code for the 'update' command: // The Update command handles updates to existing rows cmdUpdate = myConnection.CreateCommand(); cmdUpdate.CommandText = "UPDATE DaySchoolsTbl SET SchoolName=?SchoolName, SuburbID=?SuburbID, SchoolType=?SchoolType WHERE SchoolID=?SchoolID"; myParameter = cmdUpdate.Parameters.Add("?SchoolID", MySqlDbType.Int16, 40, "SchoolID"); myParameter = cmdUpdate.Parameters.Add("?SchoolName", MySqlDbType.String, 40, "SchoolName"); myParameter = cmdUpdate.Parameters.Add("?SchoolType", MySqlDbType.Byte, 1, "SchoolType"); myParameter = cmdUpdate.Parameters.Add("?SuburbID", MySqlDbType.Int16, 40, "SuburbID"); myParameter.SourceVersion = DataRowVersion.Original; myDataAdapter.UpdateCommand = cmdUpdate; Any idea what the problem is?? thanks

    .NET (Core and Framework) database help question announcement

  • Databindings fail to update db
    D dragon52

    Hi, I am using databindings to populate a combobox and several textboxes from a single datatable. When I select a record from the combobox, details of that record are displayed in the textboxes. This part of databinding works fine but when I make changes to the textboxes I want to update those changes back to the database. This update part is not working for me. No runtime errors but the db does not change. Can anyone help me? I am using a typed dataset "dsMySQL". My code is as follows: // code for form_load myDataAdapter.Fill(dsMySQL.DaySchoolsTbl); cbxDaySchools.DataSource = dsMySQL.DaySchoolsTbl; cbxDaySchools.DisplayMember = "SchoolName"; cbxDaySchools.ValueMember = "SchoolID"; tbxSchoolID.DataBindings.Add("Text",dsMySQL.DaySchoolsTbl,"SchoolID"); tbxSchoolName.DataBindings.Add("Text",dsMySQL.DaySchoolsTbl,"SchoolName"); cbxSchoolType.DataBindings.Add("SelectedIndex",dsMySQL.DaySchoolsTbl,"SchoolType"); // code for save_button myDataAdapter.Update(dsMySQL.DaySchoolsTbl); dsMySQL.DaySchoolsTbl.AcceptChanges();

    .NET (Core and Framework) database help question announcement

  • How to extract part of a string
    D dragon52

    I am calling "GetVolumeInformation" to get hold of drive volume label. The 2nd parameter of this function is declared as Dim driveLabel As String = Space(200) This string remains 200 in length even though the label returned is only 11 chars long, say "MY PROJECTS " This string delaration is giving me a lot of trouble and it completely messes up the rest of my code when I concat it with other string variables. (eg dim myText = " label is " & drivelabel). Everything become 200 in length. Does anyone know how I can extract the useful part of "driveLabel" as declared above??? That is a string with the correct "string.length" value (for "MY PROJECT " I need driveLabel.length=10)

    Visual Basic json tutorial question

  • How to code DriveInfo class
    D dragon52

    I am using VS2003. I don't have VS2005. I am rewriting in VB.Net now so I can use "GetVolumeInformation". You know VB?? I am hitting another brickwall in VB. One of the parameters used by "GetVolumeInformation" is declared as Dim driveLabel As String = Space(200) This string has length of 200 (driveLabel.length = 200)even if the useful part of the string is only 5 chars long (say "Tommy ... " ) Do you know how I can extract the useful part of "driveLabel" in VB?? I might ask this question on the VB MessageBoard

    Managed C++/CLI csharp visual-studio com help tutorial

  • How do I persist a C++ pointer?
    D dragon52

    Guffa, Are you saying that if the entire linked list is serialised the system will maintain the links between the nodes, and I don't need to code/worry about it? Do you know a code example of of a serialised linked list??? I was trying to save each node as a distinct record like your second suggestion. But how do you save the links using this option?

    .NET (Core and Framework) help question csharp c++ database

  • How do I persist a C++ pointer?
    D dragon52

    ooh yes, didn't think of that, thanks. So do you know how to persist/save a linked list to Access97 ???

    .NET (Core and Framework) help question csharp c++ database

  • How to code DriveInfo class
    D dragon52

    Thanks Milton. So do you know how I can get logical drive info such as drive label? I have seen examples using GetVolumeInformation function (in VB) that uses types such as DWORD & UINT which I am not familiar with and don't know how to translate into C++.NET

    Managed C++/CLI csharp visual-studio com help tutorial

  • How do I persist a C++ pointer?
    D dragon52

    I want to save a linked list to an Access97 database. How do I do it in ADO.Net? The following code doesn't compile/work.. CNode* pNode; pDataRow->Item["ptrNode"] = &pNode; I don't know what this compile error means "error C2102: '&' requires l-value" Also Access97 has a "number" data type, can it store a pointer??? Can anyone help???

    .NET (Core and Framework) help question csharp c++ database

  • How to code DriveInfo class
    D dragon52

    I am using VS.NET 2003. I want to use the DriveInfo class to get the volume label of the logical drives on my PC. According to Microsoft doc the DriveInfo class is part of the System::IO namespace (see "http://msdn2.microsoft.com/en-us/library/system.io.driveinfo.aspx"). But the declaraion "DriveInfo* myDriveInfo" produces a compile error. The compiler does not know about the DriveInfo class. Does any one know what I have done wrong?? Eg. it knows about "System::IO::Directory" but not "System::IO::DriveInfo" dragon_n

    Managed C++/CLI csharp visual-studio com help tutorial
  • Login

  • Don't have an account? Register

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