button - What should the statements be if a character has been entered in a textbox in C#? -


Question 1:

As the code states, if the spaces are entered in the text box The button remains disabled, but if a letter or string of characters has been entered, what should be written to enable the button? I think there should be a statement, but I do not know the statement.

  MD5CryptoServiceProvider md5 = New MD5CryptoServiceProvider (); UTF 8 encoding utf81 = new UTF 8 encoding; TextBox1.Text = BitTorrent.toString (md5.ComputeHash (utf81.GetBytes (textBox30.Text))) SHA1CryptoServiceProvider sha1 = New SHA1CryptoServiceProvider (); UTF 8 encoding utf82 = new UTF 8 encoding; Textbox2.Text = BitConver.ToString (sha1.ComputeHash (utf82.GetBytes (textBox30.Text))) (string.IsNullOrWhiteSpace (textBox30.Text)) {btnHash3.Enabled = false; } And {btnHash3.Enabled = true; }  

Question 2

On a slightly different note, two files are read from two files and after appearing within two labels, How to enable

  {System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create (); System.Security.Cryptography.SHA1 sha1 = System.Security.Cryptography.SHA1.Create (); Filestream file 1 = new file stream (lblBrowse1.Text, FileMode.Open, FileAccess.Read); Filestream file 2 = new file stream (lblBrowse2.Text, FileMode.Open, FileAccess.Read); Byte [] hash1 = MD5 Compact hash (file1); Byte [] hash2 = MD5 Compact hash (file2); File1.Seek (0, SeekOrigin.Begin); File2.Seek (0, SeekOrigin.Begin); Byte [] hash3 = shaay 1 Compact hash (file1); Byte [] hash4 = shaa 1 Compact hash (file2); File1.Seek (0, SeekOrigin.Begin); File2.Seek (0, SeekOrigin.Begin); File1.Close (); File2.Close (); Textbox1.Text = BitConverter.ToString (Hash 1). Change ("-", ""); Textbox2.Text = BitConverter.ToString (hash2). Change ("-", ""); TextBox6.Text = BitConverter.ToString (hash3). Change ("-", ""); Textbox7.Text = BitConverter.ToString (hash 4). Change ("-", "") if (text box 1 text == text box 2. text and text box 6. text == text box 7. text) {message box. Show ("These two files are similar."); } Other {message box. Show ("These two files are different."); }}  

Any help would be greatly appreciated.

To answer your first question, use. Spaces are for checking:

  bthHash3.Enabled =! MyString.Contains ("");  

Since you are just setting up a boolean, so I've fallen into a line. To give your second answer, if you are in a multi-threaded environment, then it depends on a little bit. Of course, you can always write the following:

  ReadMyFile (file1); ReadMyFile (Turn 2); MyButton.Enabled = true;  

Works after ReadMyFile, which should be blocked during reading, so the enabled line will not be killed until all the reading is complete. If you have fought, do so:

  int completeCount = 0; Void ThreadedRead () {// complete the synchronous file ++; CheckReadCompletion (); } Zero checkReadCompletion () {if (integer number == 2) myButton.Enabled = true; }  

You will start "Threaded Read" for each file to read. Please tell me that I can clarify anything!

You will not need to do this in the above situation (because you are only setting a capable flag), but with complex enough behavior, make sure that the lock around the completed code and call the CheckReadCompletion. You can modify it on:

  int completeCount = 0; Object completionLock = new object (); Void ThreadedRead () {// File Synchronous Lock (Completed Lock) {Integer ++; CheckReadCompletion (); }} Zero free resolution () {if (integer == 2) myButton.Enabled = true; }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -