
grip003
Avatar/Signature-
Posts
89 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by grip003
-
I am trying to capture the CAPS and NUMLOCK keys in an MDI application. I have set the KeyPreview to true and coded the KeyDown event. The problem occurs when a dialog form is being shown. The KeyPreview does not seem to fire when using a dialog form (using ShowDialog()). Is there a way around this without having to add code to every form that is brought up as a dialog form?
-
I am using the Windows Media Player in a C# application to play video files. It works great, except I don't want the user to be able to double click the control and have it play in full screen mode. I can pick up a double click event and do something with it, but it still moves to full screen mode afterwards. Anyone have any ideas? (I'm using the AxWMPLib.AxWindowsMediaPlayer).
-
I am also in the same predicament. I am trying to integrate a card swipe system into my existing punch clock software. I want the program to be running in the background, waiting for input to come from someone swiping their magnetic card through the machine. I found something that allows you to run a device through USB that uses a virtual COM port that you can use to interface with. Can input be detected through a COM port as well? I'm sorry this doesn't answer your question, but I am looking for the same solution. It would be much easier, I think, to be able to do the input detection directly through the USB port.
-
I wrote a simple encryption class to handle encrypting strings and byte arrays. Everything works perfectly in Windows XP and Windows 2000, but I get the following error in Windows 98: Byte array is too large. The maximum size byte array that can be encrypted by this public key implementation is 16 bytes. I am getting this error in the following code public static byte[] RSAEncrypt(byte[] DataToEncrypt, string key_file) { // Encryption is done using the public key. try { System.Windows.Forms.MessageBox.Show("Creating " + "RSACryptoServiceProvider."); // Create a new instance of RSACryptoServiceProvider RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); // Import the RSA Key information, which only needs to // include the public key information. System.IO.FileStream reader = new System.IO.FileStream( key_file, System.IO.FileMode.Open, System.IO.FileAccess.Read); System.Xml.XmlTextReader xml_reader = new System.Xml.XmlTextReader(reader); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(xml_reader); xml_reader.Close(); reader.Close(); RSA.FromXmlString(doc.InnerXml); // By default this will create a 128 bit AES object SymmetricAlgorithm sa = SymmetricAlgorithm.Create(); ICryptoTransform ct = sa.CreateEncryptor(); byte[] encrypt = ct.TransformFinalBlock( DataToEncrypt, 0, DataToEncrypt.Length); RSAPKCS1KeyExchangeFormatter fmt = new RSAPKCS1KeyExchangeFormatter(RSA); byte[] keyex = fmt.CreateKeyExchange(sa.Key); // return the key exchange, the IV (public) and encrypted data byte[] result = new byte [keyex.Length + sa.IV.Length + encrypt.Length]; Buffer.BlockCopy(keyex, 0, result, 0, keyex.Length); Buffer.BlockCopy(sa.IV, 0, result, keyex.Length, sa.IV.Length); Buffer.BlockCopy(encrypt, 0, result, keyex.Length + sa.IV.Length, encrypt.Length); return result; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Exception!!\n" + ex.Message); return null; } }// end RSAEncrypt(byte[] DataToEncrypt, string key_file) The error comes on line byte[] keyex = fmt.CreateKeyExchange(sa.Key); I have I.E. 6.0 installed on the 98 machine, which should include the strong encryption that I need, at least that's what I've heard. Can anyone help me out here?
-
I am still having problems with this. Can anyone help?
-
I have created an application that generates files as it is used. I want the uninstall program to completely remove these as well as the rest of the program. Right now, when the user uninstalls my app, it leaves the install directory along with all generated files. Is there a way to remove the entire install directory without worrying about generated files that were not included with the install package? I am using the Setup and Deployment that comes with VS2003.
-
ExecuteNonQuery() - Unable to write to stream?
grip003 replied to grip003's topic in Database / XML / Reporting
I'm sorry, I don't know what you mean by Temp-Path settings. Can you get more detailed? -
I have been looking through this forum for something dealing with an odd error I am getting. I am getting an Unable to write to stream error when I do a simple INSERT statement into a MySQL database using the .NET connector and ExecuteNonQuery(). The really interesting thing is that I do the exact same thing on a different computer, and it works. This problem has come up only on one computer and it only happens every so often. I can't lock it down. Has this happened to anyone else?
-
I threw this together, let me know how it compares... DateTime start_time, end_time; long num_primes, loop_max, test; int table_idx; bool is_prime; ResetPrimes(); primesGrid.DataSource = null; start_time = DateTime.Now; try { num_primes = Convert.ToInt64(txtNumPrimes.Text); loop_max = (long)Math.Sqrt(num_primes); for (int i=3; i<=num_primes; i+=2) { loop_max = (long)Math.Sqrt(i); table_idx = 0; test = Convert.ToInt64(prime_tbl.Rows[table_idx][0].ToString()); is_prime = true; while (test <= loop_max) { if (i % test == 0) { // Not a prime is_prime = false; break; } test = Convert.ToInt64(prime_tbl.Rows[++table_idx][0].ToString()); } if (is_prime) { prime_tbl.Rows.Add(new object[] { i } ); } } } catch (Exception ex) { MessageBox.Show("Exception!!\n" + ex.Message + "\nCancelling operation.", "Cancelling Operation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } end_time = DateTime.Now; TimeSpan ts = end_time - start_time; primesGrid.DataSource = prime_tbl; MessageBox.Show(string.Format("Operation took: {0:00}:{1:00}:{2:00}:{3:0000} to " + "complete.", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds), "Operation Finished", MessageBoxButtons.OK, MessageBoxIcon.Information); I have a text box (txtNumPrimes) that you enter the # of primes you want to generate, and the result is in the prime_tbl DataTable (which is connected to the primesGrid.DataSource for viewing the primes). More optimization can be done with the outter loop increment, but this is ok. It runs slower because of the windows form and using a DataTable, but I only had a half hour to play with this.
-
I looked into using the App.config file, which seems pretty easy. The only problem is that there is no security and someone can just open the file and look at the user name and password information for connecting to the database. Is there a more secure way?
-
I've never used the app.config file. Can you give me a simple tutorial or link so I can use it?
-
I write a lot of database applications that connect to a MySQL database. I have a UserProfile class that stores the connection settings into this database as constants, which I know can't be very good. Is there a good way to store connection settings in a program?
-
Thanks tfowler, that is the way I have been doing this in the past, I was just trying to come up with a slick form that I could use in a general way to perform any loading I wanted to do. According to marble_eater, that is just not possible. Oh well, thanks anyway.
-
I am using VS2003, and I am trying to open a form in a new thread. What I have done is started a new thread from the main one, and in that thread I create a new form. The new form is used to display some loading results from the main form, but when I show the new form I just get an hourglass and I can't press the cancel button. Here is the simple idea: Show the main form. Start a new thread in the main form for loading. In the new thread, create a 2nd form to display some loading results. While the 2nd form is shown, I want the ability to cancel the loading operation. Does this seem possible?
-
I spend most of my time programming at work, so I don't get to do much programming for fun. I program database/business applications at work, but I usually program games for fun. I find that I learn a lot more when I am programming for fun, mostly because I don't have to be productive when I am not on a timeline. It gives me the freedom to just try stuff to see how things will work. I then can bring that knowledge back to the office and apply the new stuff to my work applications.
-
I've been writing database applications for the past 4 years and I just wanted to hear some database design ideas. I have not really used an object oriented design, such as creating a class for each table in the database. Instead, I basically create a windows form for each table that allows the user the ability to make any changes they need to make. There is obviously a lot more to the application, such as posting and reporting (accounting software). Anyway, my next project I was thinking of trying a much more object oriented design. I would love to hear from anyone who has any database application experience.
-
That's an interesting idea. However, I like to do field validation where focus can be set to the field that is not validated and give a reason why. Do you take that into account for your data dictionary design?
-
This is an open thread to general thoughts and ideas about programming and interacting with a database. I have been developing windows applications that rely on a database for the past few years. I am the only developer for the company I work for, so I don't have anyone to bounce ideas off of. I got some experience in college and graduate school, but I don't seem to have the time to just play around with different programming ideas. I seem to always need to be productive. So, I wanted to see how other programmers design and implement applications that communicate with a database. Currently, I don't like to rely on binding any fields to a DataTable. I usually write a SetupFields function that loads the windows form fields with the appropriate information based on the current row in the datatable that the user has 'chosen'. I allow the user to edit the fields, and when they click Save, then I validate all fields manually (make sure monetary fields are formatted correctly, etc.) and the create an UPDATE (or INSERT INTO for a new record) statement and send that to the database. Then I update the datatable locally and continue. I've been wondering about writing classes for each table in the database and having each class be responsible for data retrieval and updates. Is this a good idea? What about validation? It seems like I am always writing validation/updating code to make changes in my database. Is there a better way to do this? I would just like to hear other stories and comments about database programming from other experienced programmers. I program in C#, but I also have some legacy applications that were written in VB6. My applications seem to work, I just want to be a better programmer.
-
I have the problem all the time, I have just been developing with C# for the past few years, that's all. Can you think of a reason why this is happening? I am having to add a button next to the text boxes that require the enter key to fire an event. The button simply does the same thing the keypress code does, it just makes my forms look messy.
-
Help Can anyone please take a look at this code and see if it acts the same as it does for me. Just follow the link to the other thread and follow the original instructions. This is causing some horrible problems in the software I've been developing for the past couple of years.
-
Oops, sorry, here it is again: http://www.xtremedotnettalk.com/showthread.php?t=93650
-
This is the third thread I have started for this problem, and so far I can not get any solution here. Please look at this link, download the code and go through the steps I have listed. It is just not working for me. I am using VS2003 Pro.
-
What do you mean by not showing it on the form? The only way I know how to retrieve information from a database is through the DataAdapter. You can load the information into a DataSet or a DataTable if you wanted to. I use MySQL as my database and I simply wrote a class for doing all my database retrievals. Here is the code I use to get a DataTable from a select sql statement: public DataTable SelectSQL_DT(string selectStr, string dtName) { try { MySqlConnection dbConnection = new MySqlConnection(connectionString); dbConnection.Open(); MySqlDataAdapter adapter = new MySqlDataAdapter(selectStr, dbConnection); DataTable my_table = new DataTable(dtName); adapter.Fill(my_table); // Dispose of the adapter, it is no longer needed adapter.Dispose(); dbConnection.Close(); return my_table; } catch (MySqlException e) { throw new Exception("SQL statement execution " + "error!!\n\n" + "Trying statement:\n " + selectStr + "\n\n" + e.Message); } } Hope that helps.
-
Thanks, I understand now.
-
I'm sorry, I still think I don't understand. The real question I think I have is can the GUI application BE the service? I use the GUI to display progress bars and I use it to set up backup scheduling. The software can also auto-burn backups as well, so the scheduling for that is also done through the GUI. Maybe this application is just not service material?