Converting C sharp to Vb.Net

I am mainly confussed with the *****'s if some one could please convert and explain the marked parts please?

The int part in **1**
The buffer in **2**
The encbuffer in **3**
The buffer2 in **4**

Thanks in advanced.

-Tim

private void Encrypt()
            {
                  try
                  {
                        GoToBusyMode();
                        progressBar.Minimum=0;
                        System.IO.FileInfo finfo=new System.IO.FileInfo(inFile);
**1**                        progressBar.Maximum=(int)(finfo.Length/32);
                        lblStatus.Text="Encrypting...";

                        System.IO.FileStream fout=System.IO.File.Open(outFile,System.IO.FileMode.Create,System.IO.FileAccess.Write,System.IO.FileShare.Write);
                        System.IO.FileStream fin=System.IO.File.Open(inFile,System.IO.FileMode.Open,System.IO.FileAccess.Read,System.IO.FileShare.Read);
**2**                        byte []buffer=new byte[32];
**3**                        byte []encbuffer=new byte[32];
                        int c=0;
*****                        while((c=fin.Read(buffer,0,32))>0)
*****                        {
*****                              if(c!=buffer.Length)
*****                              {
*****                                    byte[]buffer2=new byte[c];
*****                                    for(int i=0;i<c;i++)
**4**                                          buffer2[i]=buffer[i];
*****                                    encbuffer=rsa.Encrypt(buffer2,false);
*****                                    fout.Write(encbuffer,0,encbuffer.Length);
*****                              }
*****                              else
*****                              {
*****                                    encbuffer=rsa.Encrypt(buffer,false);
*****                                    fout.Write(encbuffer,0,encbuffer.Length);
*****                              }
                              progressBar.Increment(1);
                        }
                        fin.Close();
                        fout.Close();
                        lblStatus.Text="Encryption successful";
                        GoToReadyMode();
                  }
                  catch(Exception ex)
                  {
                        MessageBox.Show("Error:"+ex.Message);
                        thread.Abort();
                        GoToReadyMode();
                  }
            }
timmyzx7rAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
This is the result of passing the code through the utility at:
http://www.developerfusion.com/utilities/convertcsharptovb.aspx

Private Sub Encrypt()
 Try
   GoToBusyMode()
   progressBar.Minimum = 0
   Dim finfo As System.IO.FileInfo = New System.IO.FileInfo (inFile)
   progressBar.Maximum = CType((finfo.Length / 32), Integer)
   lblStatus.Text = "Encrypting..."
   Dim fout As System.IO.FileStream = System.IO.File.Open(outFile, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Write)
   Dim fin As System.IO.FileStream = System.IO.File.Open(inFile, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)
   Dim buffer(32) As Byte
   Dim encbuffer(32) As Byte
   Dim c As Integer = 0
   While (c = fin.Read(buffer, 0, 32)) > 0
     If Not (c = buffer.Length) Then
       Dim buffer2(c) As Byte
       Dim i As Integer = 0
       While i < c
         buffer2(i) = buffer(i)
         i += 1
       End While
       encbuffer = rsa.Encrypt(buffer2, False)
       fout.Write(encbuffer, 0, encbuffer.Length)
     Else
       encbuffer = rsa.Encrypt(buffer, False)
       fout.Write(encbuffer, 0, encbuffer.Length)
     End If
     progressBar.Increment(1)
   End While
   fin.Close()
   fout.Close()
   lblStatus.Text = "Encryption successful"
   GoToReadyMode()
 Catch ex As Exception
   MessageBox.Show("Error:" + ex.Message)
   thread.Abort()
   GoToReadyMode()
 End Try
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timmyzx7rAuthor Commented:
Thanks,  I found this site but it did not work correclty.

http://www.kamalpatel.net/ConvertCSharp2VB.aspx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.