Click here to Skip to main content
15,912,756 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to read XML with directory structure Pin
Karthik_Mahalingam21-May-16 22:46
professionalKarthik_Mahalingam21-May-16 22:46 
GeneralRe: How to read XML with directory structure Pin
Member 244330622-May-16 9:12
Member 244330622-May-16 9:12 
GeneralRe: How to read XML with directory structure Pin
Member 244330622-May-16 12:53
Member 244330622-May-16 12:53 
SuggestionRe: How to read XML with directory structure Pin
Richard Deeming23-May-16 1:44
mveRichard Deeming23-May-16 1:44 
GeneralRe: How to read XML with directory structure Pin
Member 244330623-May-16 13:46
Member 244330623-May-16 13:46 
QuestionIs there a source code download for this article? Pin
Member 1253641620-May-16 10:59
Member 1253641620-May-16 10:59 
AnswerRe: Is there a source code download for this article? Pin
Pete O'Hanlon20-May-16 11:21
mvePete O'Hanlon20-May-16 11:21 
GeneralRe: Is there a source code download for this article? Pin
Richard Deeming20-May-16 11:28
mveRichard Deeming20-May-16 11:28 
GeneralRe: Is there a source code download for this article? Pin
Member 1253641620-May-16 11:32
Member 1253641620-May-16 11:32 
AnswerRe: Is there a source code download for this article? Pin
Richard Deeming20-May-16 11:33
mveRichard Deeming20-May-16 11:33 
JokeRe: Is there a source code download for this article? Pin
Member 1253641620-May-16 20:01
Member 1253641620-May-16 20:01 
Questiondelete directory / folder recursive, by pass locked files Pin
jkirkerx20-May-16 10:53
professionaljkirkerx20-May-16 10:53 
AnswerRe: delete directory / folder recursive, by pass locked files Pin
Member 244330620-May-16 11:50
Member 244330620-May-16 11:50 
GeneralRe: delete directory / folder recursive, by pass locked files Pin
jkirkerx20-May-16 12:30
professionaljkirkerx20-May-16 12:30 
AnswerProblem 2, access the HKLM as Admin doesn't work Pin
jkirkerx20-May-16 12:36
professionaljkirkerx20-May-16 12:36 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
Member 244330620-May-16 12:53
Member 244330620-May-16 12:53 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
jkirkerx21-May-16 12:00
professionaljkirkerx21-May-16 12:00 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
jkirkerx22-May-16 7:28
professionaljkirkerx22-May-16 7:28 
AnswerRe: delete directory / folder recursive, by pass locked files [done] Pin
jkirkerx22-May-16 7:31
professionaljkirkerx22-May-16 7:31 
GeneralRe: delete directory / folder recursive, by pass locked files [done] Pin
Member 244330622-May-16 9:14
Member 244330622-May-16 9:14 
QuestionDotnetbar in C# Pin
Member 1051156220-May-16 1:18
Member 1051156220-May-16 1:18 
AnswerRe: Dotnetbar in C# Pin
Pete O'Hanlon20-May-16 1:42
mvePete O'Hanlon20-May-16 1:42 
JokeRe: Dotnetbar in C# Pin
Richard Deeming20-May-16 1:57
mveRichard Deeming20-May-16 1:57 
AnswerRe: Dotnetbar in C# Pin
Richard MacCutchan20-May-16 1:49
mveRichard MacCutchan20-May-16 1:49 
Questiontrouble with combobox and datagridviews Pin
Simon_Whale20-May-16 1:08
Simon_Whale20-May-16 1:08 
I'm trying to work out why here, but I am stuck and also have no GoogleFu luck on Friday

I have a datagridview which I attach a combo box to a specific cell with the following code.

C#
private void dg_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
    DataGridView dg = sender as DataGridView;

    DataGridViewComboBoxColumn combo = dg.Columns[0] as DataGridViewComboBoxColumn;
    LogManager.Instance.Logger("Policy SI").Info("Edit Control Showing");
    if (dg.CurrentCellAddress.X == combo.DisplayIndex)
    {
        LogManager.Instance.Logger("Policy SI").Info("We have a combo");
        cb = e.Control as ComboBox;
        if (cb != null)
        {
            cb.SelectedIndexChanged -= new EventHandler(cb_SelectedIndexChanged);
            cb.DropDownStyle = ComboBoxStyle.DropDown;
            cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
        }
    }
}


the SelectedIndexChanged event takes a copy of the selected value's text.

C#
private void cb_SelectedIndexChanged(object sender, EventArgs e)
{
    originalDescription = cb.Text;
}


This works great, for all the grids that the edit control showing event is subscribed too, but while tracing another problem I have noticed that when I am getting the row out of the combo box's datasource which is a bindinglist and reading the information to pass back to the database. with the following simplified event below. Each property that I read then fires the selected index event of the combobox.

C#
private void dg_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            
            DataGridView dgB = sender as DataGridView;
            if (dgB.CurrentRow.IsNewRow == true) 
            {
                LogManager.Instance.Logger("Policy SI").Info("New Row ");
                return; 
            }

            if (e.ColumnIndex == 0)
            {
                LogManager.Instance.Logger("Policy SI").Info("Validating Col 1");
                string newDescription = string.Empty;
                newDescription = e.FormattedValue.ToString();

                quoteTemplate = valuablesBinding.FirstOrDefault(p => p.Description == originalDescription || p.Description == policySumInsured.Description);
                
                //Attempted here to deepclone the object from the valuables bindinglist
                //quoteTemplate = quoteTemplateNewDescription.DeepClone();  

                 //Here with these 3 lines it will then fire the selectedindexchanged 
                 //event that is on the combobox
                policySumInsured.ItemNo = (int)quoteTemplate.ItemNo;
                policySumInsured.Description = quoteTemplate.Description;
                policySumInsured.Section = quoteTemplate.Section;
            }
            else
            {
                if (e.ColumnIndex == 1)
                {
                    //Other validation routine here
                }
            }     
        }


Hopefully this all makes and sense and someone could possibley shed some light on why it keeps firing the cb_selectedIndexChanged event.

Thanks
Simon
Every day, thousands of innocent plants are killed by vegetarians.

Help end the violence EAT BACON

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.