DdoubleD 315 Posting Shark

Here is an example of capturing the KeyDown and KeyPress events for a textbox to limit numeric input. You could also modify this logic to accept only the characters you want: Limiting input in control...

In addition to the examples sknake gave you, you might want to read up on Validating and Validated methods: Validating entered data...

DdoubleD 315 Posting Shark

Please use code tags:

[code=csharp]
...code here....
[/code]

I don't think your code will compile. DataGrid.CurrentCell is a property, not a method...

Did you just copy and paste that event handler (DataGrid_Click), or did you use the designer to create it?

You can access those text values using the object you provided as the DataSource .

DdoubleD 315 Posting Shark

Is this what you are looking for: dateTimePicker.Value.AddDays(2.0);

DdoubleD 315 Posting Shark

I was kind of in a hurry this morning and my internet connection has been flaky the last couple of days (real bad this morning). I posted that code without testing it, and there were a couple of logic errors as well as an important missing part in the handling of the CellValueChanged event handler.

I decided to clean up the code and make it just a tad more generic too. I have also commented the code and left a couple of original lines commented out where I dropped the "Country, Store, City" enum. You should be able to see it as only a slight change in the call to your SetPermission method parameters. I do not call the UpdatePermissions method in this code, but it sets up the values needed for your SetPermission method, with the minor exception of the dropped enum for "Country, Store, & City", which you can change to use the code you have.

The listBox1 control is just an output for testing that the datatable binding updated the values correctly...

Regardless of how you are binding data to the gridview, I think you should be able to accomplish your task by extracting what you need from this example:

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 PermissionType = ForumSolutions.DatabaseStuff.PermissionsTable.PermissionType;
using PermissionsTable = ForumSolutions.DatabaseStuff.PermissionsTable;

namespace ForumSolutions
{
    public partial class Form_DataGridView_PermissionsTable : Form
    {
        DataTable dt;
        const int iNoneCol = (int)PermissionType.None + 1; …
sknake commented: great post +5
DdoubleD 315 Posting Shark

I played around with this for a couple of hours--no success! :@

If all you are doing is changing the File Summary Properties, try using this alternative instead:

1) Download Microsoft Developer Support OLE File Property Reader 2.1 Sample
2) Add reference to the "dsofile.dll" to your project
3) Utilize this snippet of code:

private static void UpdateOleDocSummaryProperties(string fName)
        {
            //Create the OleDocumentProperties object.
            DSOFile.OleDocumentProperties dso = new DSOFile.OleDocumentProperties();

            try
            {
                //Open the file for writing...
                dso.Open(fName, false, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);

                //Set the summary properties that you want.
                dso.SummaryProperties.Title = "My Title";
                dso.SummaryProperties.Subject = "My Subject";
                dso.SummaryProperties.Company = "My Company";
                dso.SummaryProperties.Author = "My Name";

                //Save the Summary information...
                dso.Save();
            }
            catch (Exception e)
            {
                Console.WriteLine("Message: {0}\r\nStack: {1}", e.Message, e.StackTrace);
            }
            finally
            {
                //Close the file.
                dso.Close(false);
            }
        }

It is much faster too I think than the word interop stuff and without all the overhead and cryptic "crapiola". It also works with other documents so that's a plus!

Sorry I couldn't get your word interop stuff to work. You are doing everything according to the documentation that I can see, but they sort of left off the "Save" and "Quit" discussion. If you or someone else gets the interop code to work for this, please post the solution for everyone else.

DdoubleD 315 Posting Shark

Or even a dropdown TreeView connected to a TabControl that drives the tab page selection based on the level of drill-down...

DdoubleD 315 Posting Shark

Is this what you are looking for?:

private void RunMyReport(ReportDocument crDoc)
        {
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            crConnectionInfo.ServerName = "YOUR SERVER NAME";
            crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
            crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
            crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
            
            // setup before passing to the viewer...
            ReportSourceSetup(crDoc, crConnectionInfo);

            crystalReportViewer1.ReportSource = crDoc;
            crystalReportViewer1.Refresh();
        }
        public static void ReportSourceSetup(ReportDocument crDoc, ConnectionInfo crConnectionInfo)
        {
            // Each table in report needs to have logoninfo setup:
            Tables crTables = crDoc.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
            {
                TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo;
                crTableLogonInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogonInfo);
            }
        }

// calling...
        RunMyReport(ss);
DdoubleD 315 Posting Shark

If you set the comboBox1.SelectedIndex to a value, it will call the event handler automagically...

DdoubleD 315 Posting Shark
const int iNoneCol = (int)PermissionType.None + 1;
        const int iROCol = (int)PermissionType.ReadOnly + 1;
        const int iRWCol = (int)PermissionType.ReadWrite + 1;

        const int iCountryRow = (int)Permission.Country;
        const int iStoreRow = (int)Permission.Store;
        const int iCityRow = (int)Permission.City;

        private void InitCheckBoxValues()
        {
            for (int iRow = iCountryRow; iRow <= iCityRow; iRow++)
            {
                DataGridViewCheckBoxCell cbcNone = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iNoneCol];
                DataGridViewCheckBoxCell cbcRO = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iROCol];
                DataGridViewCheckBoxCell cbcRW = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iRWCol];

                cbcNone.Value = cbcNone.TrueValue = true;
                cbcNone.FalseValue = false;

                cbcRO.Value = cbcRO.FalseValue = false;
                cbcRW.Value = cbcRW.FalseValue = false;
                cbcRO.TrueValue = cbcRW.TrueValue = true;
            }
        }

        // Occurs when the value is changed...
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int iCol = e.ColumnIndex;
            int iRow = e.RowIndex;
            if (iRow > -1 & iCol >= iNoneCol)
            {
                System.Diagnostics.Debug.Assert(dataGridView1.Rows[iRow].Cells[iCol].ValueType == typeof(bool));

                DataGridViewCheckBoxCell cbcNone = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iNoneCol];
                DataGridViewCheckBoxCell cbcRO = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iROCol];
                DataGridViewCheckBoxCell cbcRW = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iRWCol];

                if (iCol == iNoneCol && cbcNone.Value == cbcNone.TrueValue)
                {
                    cbcRO.Value = cbcRO.FalseValue;
                    cbcRW.Value = cbcRW.FalseValue;
                }
                else if (iCol == iROCol && cbcRO.Value == cbcRO.TrueValue)
                {
                    cbcNone.Value = cbcNone.FalseValue;
                    cbcRW.Value = cbcRW.FalseValue;
                }
                else if (iCol == iRWCol && cbcRW.Value == cbcRW.TrueValue)
                {
                    cbcNone.Value = cbcNone.TrueValue;
                    cbcRO.Value = cbcRO.TrueValue;
                }
                // default to none CB if none selected...
                if (!(cbcRO.Value == cbcRO.TrueValue || cbcRW.Value == cbcRW.TrueValue))
                    cbcNone.Value = cbcNone.TrueValue;
            }
        }

        private void UpdatePermissions(int userID)
        {
            
            for (int iRow = iCountryRow; iRow <= iCityRow; iRow++)
            {
                Permission feature = (Permission)iRow;
                PermissionType permission;

                DataGridViewCheckBoxCell cbcNone = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iNoneCol];
                DataGridViewCheckBoxCell cbcRO = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iROCol];
                DataGridViewCheckBoxCell cbcRW = (DataGridViewCheckBoxCell)dataGridView1.Rows[iRow].Cells[iRWCol];
                if (cbcNone.Value == cbcNone.TrueValue)
                    permission = PermissionType.None;
                else if (cbcRO.Value == cbcRO.TrueValue) …
DdoubleD 315 Posting Shark

Why do you care what method/step the user uses to close your application? I see this type of question a lot, and it's generally due to overlooking the behavior of the Form.Closing event..., which is a cleaner approach in my opinion. If the user needs to save data or something, you can notify user and prevent the form from closing.

DdoubleD 315 Posting Shark

I get "Error 1 A namespace does not directly contain members such as fields or methods" on char roomType, member; :S

You probably have unaligned brackets or something. It's telling you that you have defined a field or method outside of your class (Program). If you still have this trouble, post the code from the entire Program.cs file from top to bottom...

DdoubleD 315 Posting Shark

Your discount calculation is incorrect. Here is the correct discount computation for 30% discount:

decimal discountedCost = cost - (cost * 0.30M);
DdoubleD 315 Posting Shark

Please use code tags:

&#91;code&#93;
...code here....
&#91;/code&#93;


Your logic flow is a little weird to me. Shouldn't you just ask all the questions up front, then use their input in the if statements, verses checking this and asking that, etc.?

DdoubleD 315 Posting Shark

Have you tried googling "midi c#"? There is a lot of stuff out there--not sure if there is anything specific you are looking for...

DdoubleD 315 Posting Shark

Is this SOLVED? If so, please mark as SOLVED, otherwise please restate the current problem. Thanks.

DdoubleD 315 Posting Shark

It sounds like you need to set the report's connection info for each of the tables. Try passing in the ReportDocument to this after you have set the table parameters, but before attempting to run/view the report:

public static void ReportSourceSetup(ReportDocument crDoc, ConnectionInfo crConnectionInfo)
        {
            // Each table in report needs to have logoninfo setup:
            Tables crTables = crDoc.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
            {
                TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo;
                crTableLogonInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogonInfo);
            }
        }
DdoubleD 315 Posting Shark

Can you zip and attach the small application (project/solution) in question with any relevant word doc (is it in English?)?

DdoubleD 315 Posting Shark

There may be a more elegant way to do this, but here is the logic I applied in a small program to demonstrate one way to get and set the checked state when the user clicks the cell's checkbox:

// This event occurs before the cell's state is committed,
        // so you have to check the current value and then negate it
        // to get the proposed state change...
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int iCol = e.ColumnIndex;
            int iRow = e.RowIndex;

            if (dataGridView1.Rows[iRow].Cells[iCol].ValueType == typeof(bool))
            {
                if (dataGridView1.Rows[iRow].Cells[iCol].Value == null ||
                    (bool)dataGridView1.Rows[iRow].Cells[iCol].Value == false)
                {
                    dataGridView1.Rows[iRow].Cells[iCol].Value = true;
                }
                else
                {
                    dataGridView1.Rows[iRow].Cells[iCol].Value = false;
                }

            }
        }

        // Occurs when the value is changed...
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int iCol = e.ColumnIndex;
            int iRow = e.RowIndex;
            if (iRow > -1 & iCol > -1)
            {
                if (dataGridView1.Rows[iRow].Cells[iCol].ValueType == typeof(bool))
                {
                    bool bChecked = (bool)dataGridView1.Rows[iRow].Cells[iCol].Value;
                }
            }
        }

I don't know what you are doing with your SetPermission, but according to what you stated you want to do, you can call that inside the dataGridView1_CellValueChanged event if that is what you want to do.

DdoubleD 315 Posting Shark

Nothing obvious standing out that I can see. What happens if you comment out that log.wtl("...") statement? Also, if there are other locations in the code where these Settings members or CheckBox.Checked states get modified, I would watch out for that too.

DdoubleD 315 Posting Shark

See MSDN documentation for more details: CellContentClick

EDIT: Removed code that didn't work!!!--sorry, I should have ran it first.

DdoubleD 315 Posting Shark

Check the value of your comboBox1.SelectedItem.ToString() . My guess it isn't what you think: "*.doc". Have you defaulted the selection before using (eg. SelectedIndex = 0)? Also, you can just use the ComboBox.Text Property to access the selected item's text as displayed in the combobox.

DdoubleD 315 Posting Shark

Hi, I spent a good deal of time researching the subject this morning, and this is what I have learned...

There are only three ways to do this that I could find:

  • DDE
  • Command Line Parameters
  • Plug-In (Purchased or Licensed by Adobe)

Plug-In

There are third-party plug-in's available for a cost, but I did not research these and I don't know if you must also buy Adobe Acrobat.

You can also buy the Adobe Acrobat software and create a plug-in for your application that has to be approved and licensed by Adobe, which may or may not decide to approve what you are doing. If this option apeals to you, contact Adobe and begin a discussion.

DDE (Dynamic Data Exchange)

This technology is as old as Windows itself. As far as I can determine, it is still supported by Adobe for backward compatibility, but I did not check any version history information for the Reader to ensure this is factual. There use to be an open source project (NDde) on CodePlex that provided a library interface to facilitate DDE development, but they have removed the download link. This library might still be available somewhere, but I did not pursue this. Here are some DDE links I ran into:

Small ReaderWrapper class written in CPP

DDE Reader example using NDde

Another Reader example using NDde, with very informative links inside...

DDE Information (FAQ) - Client and Server DDE libraries written in VB

DdoubleD 315 Posting Shark

Assuming that the "pwdlastset" value will always be zero until the user logs in to reset their password, you won't know the expiration date to be calculated with the 90 day "maxpasswordage" property until they login I believe.

If user is already being forced to change password, then you really can't send them a message unless they are logged in, in which case you could just inform them of the expire and 90 day limit...

If this is for reporting or maintenance purposes, then you know from the
lastlogin property when the last time they logged in was; and from the pwdlastset property that as of current they have not logged in to reset...

Not sure what you are looking for...

DdoubleD 315 Posting Shark

That's great! If you feel your problem is resolved (does appear to be), please mark this thread as solved. Cheers!

DdoubleD 315 Posting Shark

you mean make the bulk not in c#? the bulk could be done in stored procedure?

No problem. So you know, that is just my opinion and it comes from a an Oracle background some years back. There might be other ways that are just as efficient, perhaps more, but what I suggested is based on my experience.

Cheers!

DdoubleD 315 Posting Shark

That was very nice that you posted your program/solution so everyone could see it. Couple of suggestions:
1) you define your connection string in multiple places... consider just creating a single "const string" definition for the whole class
2) be careful about posting details of your connection string, especially for "root" uid and password; it's better you don't share this information with the world.

DdoubleD 315 Posting Shark

I think you need to read up on using multi-dimensional arrays in C# so you understand what you are doing, but in both of those brackets you need numbers to access the string instead of a string[], which is what it currently resolves to.

Not to discourage you from learning how to access multi-dimensional arrays, but you should consider using a strongly typed List<> instead, if you instructor would approve.

DdoubleD 315 Posting Shark

I don't have a LDAP server to play around with the code, but that date looks suspiciously like a minimum system date (1/1/1601) with 90 days added to it. Is it possible the user has never logged in and the PwdLastSet is therefore set to zero?

DdoubleD 315 Posting Shark

Your unsortedarray is two dimensions, but you are comparing it as though it were only one. Look at line 31 and see how you accessing areacode, then look at your if statement at line 49--see the difference?

DdoubleD 315 Posting Shark

My suggestion was for you to do the bulk of the work in a "stored procedure" in the database after loading a temporary table with CSV. The "stored procedure" would delete all records from perm table where the given key field matches those found in the temp table, then insert ALL records from the temp table into the perm table.

DdoubleD 315 Posting Shark

Try this:

public static int DeleteRecord(string bookID)
        {
            const string query = "DELETE FROM Books WHERE l_bookID = @l_bookID";
            using (SqlConnection conn = new SqlConnection(connStr))
            {
                conn.Open();
                using (SqlCommand cmd = new SqlCommand(query, conn))
                {
                    cmd.Parameters.Add(new SqlParameter("@l_bookID", SqlDbType.VarChar)).Value = bookID;
                    return cmd.ExecuteNonQuery();
                }
            }
        }
DdoubleD 315 Posting Shark

If I've understood correctly, you need to update the database table to reflect new and updated records from a given CSV file. So, if you can replace the existing table's record instead of the need to update the record, I think the most efficient way to do this would be to:

1) import/insert the CSV file into a temporary table in your database.
2) launch a stored procedure that:
a) deletes those records that already exist in perm table
b) insert all records from the temporary table using only the needed columns

DB updates are generally much slower than the above technique.

DdoubleD 315 Posting Shark

Here are the changes you requested. I did not modify the code that determines the actual pct of matching because you indicated that was how you wanted it to work--so don't ask me to change that portion of your code because I want to clear this off my desk so-to-speak...

In the code that follows, you will find my changes easily, because it is practically the only code that has comments! What I did was store the SearchResults meeting your existing pct match routines (with the exception of modifying the return value of CompareString method), sort the pct match, then added them to your results in descending order (highest pct match first). I hope this solves your problem.

public SearchResult[] FindString(string Text)
    {
        // SearchResults keyed by matched pct...
        Dictionary<decimal, SearchResult> dictResults = new Dictionary<decimal, SearchResult>();
        // Create a list of match pct keys, sort...
        List<decimal> sortedKeys = new List<decimal>();

        List<SearchResult> result = new List<SearchResult>();

        foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
        {
            if (type.IsSubclassOf(typeof(Form)))
            {
                if (this.ExcludeTypes.Contains(type))
                    continue;

                using (Form f = (Form)Activator.CreateInstance(type))
                {
                    // Now returns mathced pct instead of bool...
                    decimal matchPct = CompareString(Text, f.Text);
                    
                    //if (CompareString(Text, f.Text))

                    // Only add if matched pct made minimum criteria...
                    if (matchPct > 0.0M)
                    {
                        SearchResult sr = new SearchResult(type, f.Text);
                        sr.Images.AddRange(FindImage(f));
                    
                        // Add new SearchResult to our keyed matches...
                        dictResults.Add(matchPct, sr);
                        // Add key to our sort list...
                        sortedKeys.Add(matchPct);
                    }
                }
            }
        }

        // sort the list of keys for sorted lookup...
        sortedKeys.Sort();

        // Add each SearchResult in order …
DdoubleD 315 Posting Shark

It sounds like you want to merge a "CSV" file with an existing db table. See if this information will help you:
DataTable.Merge

DdoubleD 315 Posting Shark

In your particular code example, you could eliminate the else clause and simply move the return false; to just before the end of your method block:

private bool OpenDbConnection(SqlConnection sql_con_obj)
        {
            try
            {
                //SqlConnection.ClearPool(sql_con_obj);
                //SqlConnection.ClearAllPools();
                if (sql_con_obj.State == ConnectionState.Closed || sql_con_obj.State == ConnectionState.Broken)
                {
                    sql_con_obj.ConnectionString = "Data Source=.;Initial Catalog=Practice;User ID=sa;Password=sa";
                    sql_con_obj.Open();
                    return true;
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
            }
            
            return false;
        }

In structuring the method's return value this way, and should you decide to add more catch(exception) clauses, etc., you will always have a return false statement at the end of your method indication failure and not have to place additional return statements for every exception type handled, which litters up the code a little.

DdoubleD 315 Posting Shark

No problem. Cheers!

DdoubleD 315 Posting Shark

i think im having a search problem..i think that i should find dll
for ActiveAppearanceModel and C5 and dnAnalytics needed in source file we are talking about
but i searched finding no suitable results :(

ddanbe
im afraid ur site is not working
can u check it plz

thanks all

I think you need to register and install Subversion software to obtain packaged projects--it's an open-source group project. From what I could see, you can still obtain/download all of the files, including the project files, and add them to your solution. I realize that is a lot of work for just wanting to check into it...

As far as that link ddanbe gave you, there is a minor typo in the address. Just delete the last two characters from the address in your browser window and it will navigate to the site. EDIT: Silly me, here is the correct address: Concave Hull

DdoubleD 315 Posting Shark

Thanks for the positive feedback Scott. It started out somewhat smaller, but the real excitement came in getting that event handler code into operation.

I still haven't run a test outside a LAN, but maybe someone will try it sometime and let me know.:P

DdoubleD 315 Posting Shark

Sure. I added an edit to the end of my post and wasn't sure if you saw it, so take another peek...

DdoubleD 315 Posting Shark

I found the question interesting, so I decided to look around the internet a little. It's an interesting topic--what are you using it for?

Anyway, I did run into this link containing what looks like some well-written shape analytics. Although I have not looked into it deep enough to determine whether the value it returns for NOT convex is reliable, which the comments indicate it is then concave, I thought it was worthy of passing along: Shapes.cs

I should point out that the code requires other libraries, but I believe it is all open source. Just search for the required namespace and include the word "library" (eg "ActiveAppearanceModel library") on the Koders.com website. In that example I gave, it will bring up a link to the ActiveAppearanceModel.cs file...click on it and it will bring up a page where the project link is located: ActiveAppearanceModel.cs, and project links to the left..., etc.

DdoubleD 315 Posting Shark

Hello

I have seen the following method syntax and I am trying to understand how this works/or doesn't:

public class MyClass
    {

       public MyClass();

        public MyClass(string param);
  }

There is no implementation of the methods (constructors) and class is not declared virtual either...
Is this something new in C# 3.0 ???

Any ideas???

Thank you

Perhaps you saw some C++ code that looks like this, which in its simplest form, is very similar in appearance. In C++, this is called forward declaration. C# does not allow forward declarations.

ddanbe commented: Nice observation. +5
DdoubleD 315 Posting Shark

Sounds like you are trying to create a keyboard sniffer program?

DdoubleD 315 Posting Shark

What is a "Master Detail"?

DdoubleD 315 Posting Shark

I took the bulk of this code from an MSDN example. I have used TreeView a few times, but not Active Directory objects. To use, create a form and drag a TreeView control and a DirectoryEntry component onto the form, and wire the Load event...

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;

namespace ForumSolutions
{
    public partial class Form_ActiveDirectoryTreeView : Form
    {
        public Form_ActiveDirectoryTreeView()
        {
            InitializeComponent();
        }
        private void Form_ActiveDirectoryTreeView_Load(object sender, System.EventArgs e)
        {
            TreeNode users = new TreeNode("Users");
            TreeNode groups = new TreeNode("Groups");
            TreeNode services = new TreeNode("Services");
            treeView1.Nodes.AddRange(new TreeNode[] { users, groups, services });

            directoryEntry1.Path = @"WinNT://"+ Environment.MachineName;//WinNT://Domain/YourComputerName

            foreach (System.DirectoryServices.DirectoryEntry child
               in directoryEntry1.Children)
            {
                TreeNode newNode = new TreeNode(child.Name);
                switch (child.SchemaClassName)
                {
                    case "User":
                        users.Nodes.Add(newNode);
                        break;
                    case "Group":
                        groups.Nodes.Add(newNode);
                        break;
                    case "Service":
                        services.Nodes.Add(newNode);
                        break;
                }
                AddPathAndProperties(newNode, child);
            }
        }

        private void AddPathAndProperties(TreeNode node,
           System.DirectoryServices.DirectoryEntry entry)
        {
            node.Nodes.Add(new TreeNode("Path: " + entry.Path));
            TreeNode propertyNode = new TreeNode("Properties");
            node.Nodes.Add(propertyNode);
            foreach (string propertyName in entry.Properties.PropertyNames)
            {
                string oneNode = propertyName + ": " +
                   entry.Properties[propertyName][0].ToString();
                propertyNode.Nodes.Add(new TreeNode(oneNode));
            }
        }
    }
}
DdoubleD 315 Posting Shark

I am going to BUMP on this one because nothing I can see to cause that string assignment to occur that way.

I assume you added the following lines to try to elliminate the problem:

path = path.Trim(Path.GetInvalidFileNameChars());
                        path = path.Trim(Path.GetInvalidPathChars());

but, you shouldn't need to be doing that either given the code I've seen. Also, I have not used those calls in a string.Trim before--have you tried it without those two lines?

Anyway, I've got somewhere I need to get to... Just post back a response and someone else will surely look into this before I get back.

DdoubleD 315 Posting Shark

Thanks DdoubleD!
That really helps. I was probably looking for the wrong words like pause and wait.:idea:

I actually had flashbacks of that same thinking in the past... I was just hoping it was that simple.:P

DdoubleD 315 Posting Shark

We should probably determine why you got those null characters ( \0 stored for your "filename" in the first place. What is the code you are using to INSERT or UPDATE the "filename" field?

DdoubleD 315 Posting Shark

If you don't mind that the thread will halt for 2 seconds, you can use Thread.Sleep(2000).

sknake commented: you got it +5
DdoubleD 315 Posting Shark

What is the value in path when it reaches line 32?

DdoubleD 315 Posting Shark

But I can see the name of the image I selected in the table, so what cud be the problem and how can I solve it. any code or example will do Please

Post your current code, indicating the line you get the error, and also indicate the values being used in the call.