Jump to content


Check out our Community Blogs

Pierce

Member Since 05 Mar 2012
Offline Last Active Mar 08 2012 09:59 AM
-----

Topics I've Started

Convert Embedded WMF

07 March 2012 - 06:36 PM

I have a bunch of binary files with what appear to be embedded Windows Meta Files:

{\pict\wmetafile8\picw9031\pich827\picwgoal5119\pichgoal468
010009000003F901000005001C0000000000050000000B0200000000050000000C023B03472303
0000001E00030000001E00050000000C02D5010014050000000B020000000008000000FA020000
0000000000000000040000002D0100001C000000FB0238FF000000000000900100000001070000
00417269616C00F47740000000440E0A440786F5771086F5770100000000003000040000002D01
010005000000020101000000050000000102FFFFFF00050000002E011800000005000000090200
blah blah blah
}

Is there a way to convert what I am looking at back into an image with C#?

Add Current Data Row to an Array or String Variable

06 March 2012 - 05:52 PM

I have managed to muddle my way into rebuilding my old VB6 app in C#, and it works. Now I want to make it work better, or at least what I feel will be better.

I have a form with two text boxes [txtFilePath & txtFileName] that are bound to the FilePath and FileName fields in the database that I have selected and opened earlier in the code. The process below cycles through the database, building a full file path from the two entries in the database which is then passed to File.Exists to make sure that the referenced file is actually on the hard drive. What I would like to do is remove the dependency on the bound text boxes by having the data which normally appears in them pass from the database directly into a string. I've been scouring the web to no avail for several hours now. Since I am able to advance to the next row by using uniObjBindingSource.MoveNext(); it seems to me that there should be a simple way to read the current row into an array or two string variables. Am I wrong?

private void cmdVerify_Click(object sender, EventArgs e)
        {
            //Progress bar stuff
            barProgress.Visible = true;
            barProgress.Minimum = 1;
            barProgress.Maximum = uniObjBindingSource.Count;
            barProgress.Value = 1;
            barProgress.Step = 1;

            //Get values for record count and current position
            int iRecords = uniObjBindingSource.Count;
            int iCurrentRecord = uniObjBindingSource.Position;

            //txtReport.Text = (1 + iCurrentRecord).ToString() + " of " + iRecords.ToString();

            string rawPath = txtFilePath.Text;
            string driveLetter = rawPath.Substring(1, 1);
            
            //Parse out crappy TD filepath entry
            int iLength;
            iLength = rawPath.Length;
            string trimmedPath;
            trimmedPath = rawPath.Substring(4, (iLength - 4));

            //Give File.Exists something to work with
            lblStatus.Text = driveLetter + ":\\" + trimmedPath + "\\" + txtFileName.Text;
            string checkFile = lblStatus.Text;
            
            //Cycle through entire database
            do 
            if (File.Exists(checkFile))
	        {
                uniObjBindingSource.MoveNext();
                lblStatus.Text = driveLetter + ":\\" + trimmedPath + "\\" + txtFileName.Text;
                checkFile = lblStatus.Text;
                iCurrentRecord = uniObjBindingSource.Position;
                Application.DoEvents();
                barProgress.PerformStep();
                    if(bStop)
                    {
                        break;
                    }
	        }
            else
            {
                txtReport.AppendText("Not Found: " + checkFile + Environment.NewLine);
                uniObjBindingSource.MoveNext();
                lblStatus.Text = driveLetter + ":\\" + trimmedPath + "\\" + txtFileName.Text;
                checkFile = lblStatus.Text;
                iCurrentRecord = uniObjBindingSource.Position;
                Application.DoEvents();
                barProgress.PerformStep();
                    if (bStop)
                    {
                        break;
                    }
            }
            while(iCurrentRecord <= iRecords);
            cmdSaveReport.Enabled = true;
        }

C# Equivalent for VB6 DAO?

05 March 2012 - 06:25 PM

I am attempting to recode a utility that I initially coded in VB6 years ago into a C# version. Unfortunately, this simple little utility was built on DAO which is no more.

My utility allowed me to navigate out to a database which had a set structure (tables and fields) but was rarely in the same location and never had the same file name. As a result of this I cannot use the wizard that is touted all over the web and in the three books that I have read in an attempt to re-create my program; Mastering Visual Basic 2010 (Petroutsos), ADO.NET 4 (Patrick) and C# 2010 (Murach).

The utility had four text boxes that, once you navigated out to the correct .mdb file, would display the contents of four fields they were bound to by setting such in the object properties. Once combined these text boxes would form a full path to a file, which I would then check to see if it actually existed on the hard drive. Unfortunately, the simplicity of this operation using the DAO seems to have become a thing of the past. If someone could please point in the direction of a tutorial, reference or sample code that would help me on my way it would really be appreciated. I have spent more hours than I choose to count trying to find something helpful on the web.

Thanks.

~Pierce

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download