cgeier 187 Junior Poster

The problem is that "An item with the same key has already been added."

Every key is not unique in the data that you provided, because you use two dictionaries. I recommend against using "key" and "value" as your variable names, especially when you choose to use the following in one of your dictionaries: this.latinka.Add(value, key) This can cause confusion because a dictionary add is <key, value>.

Solution: Your error occurs in this.latinka.Add(value, key). The variable "value" contains a value that already exists, which happens to be the key for this dictionary. Confused? This is why it is important to choose good variable names. The duplicate is "--..."

Modify your code as follows to see the error:

private void ReadDictionary(string filename)
{
    string key = string.Empty;
    string value = string.Empty;

    string cesta = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
    try
    {
        string[] lines = File.ReadAllLines(filename, Encoding.Unicode);
        if (lines != null)
        {

        }
        foreach (string line in lines)
        {
            string[] znaky = line.Split('=');
            key = znaky[0];
            value = znaky[1];

            try
            {
                this.morzeovka.Add(key, value);
            }//try
            catch (Exception ex)
            {
                string errMsg = "Error (morzeovka): " + ex.Message;
                //errMsg += "(" + ex.StackTrace + ")";
                errMsg += System.Environment.NewLine + System.Environment.NewLine;
                errMsg += "morzeovka key: '" + key + "' morzeovka value: '" + value + "'";

                MessageBox.Show(errMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//catch

            try
            {
                this.latinka.Add(value, key);
            }//try
            catch (Exception ex)
            {
                string errMsg = "Error (latinka): " + ex.Message;
                //errMsg += "(" + ex.StackTrace + ")";
                errMsg += System.Environment.NewLine + System.Environment.NewLine;
                errMsg += "latinka key: '" + value …
cgeier 187 Junior Poster

I think that you are going about this the wrong way.

Why are you set in using Notepad to view your file? Have you considered using Wordpad (or Word) to view it? They will display the file correctly if the lines are terminated with CR (or VbCr).

Note: You can change your file association so that .txt files open with Wordpad (or Word).

Why don't you just have the IT person generate the reports in the format that you need them? Surely, it is cheaper to pay the IT person 1 hr (if that) to create the proper reports than to pay you 10 hrs to write your scripts--unless you're doing this on your personal time as an educational experience.

If you still believe that you need to create a script/program to help you modify your reports, I think that you need to start from the beginning. State/show the report that you have and what you would like the end result to be.

There are some questions that need to be answered in order for anyone to be able to provide useful answers.

-What is the folder structure (ie: what are the folder names)? Provide 2-3 fully qualified folder names so one can get an idea of the folder structure.

-What are the file names? (You already provided an answer for this)

-Where do you want to store the converted files? In the original folders?

-What do you want the converted files to look like?

-What do you want the …

cgeier 187 Junior Poster

It would be easier to understand what you are trying to do if you post screen shots from the program. As an alternative, you could create tables in Word/Wordpad that represent the two datagridviews and post those-describing what you desire to accomplish.

cgeier 187 Junior Poster

From what I recall in using the program, not all of the items one may perceive as buttons, knobs, switches, etc are clickable, but MS does allow one to create keyboard shortcuts for some items. I haven't created any panels, but I believe that you may be able to achieve what you want by creating your own panel (or modifying an existing one). See my previous post.

cgeier 187 Junior Poster

You might have better luck if you explain what the data is for. Do you want to break the string into 2-character hex strings and convert those to binary? If so,

From the original post:
242465313037382c303134353637...

Splitting the string into 2-character pieces would be:
24 24 65 31 30 37 38 2c 30 31 34 35 36 37...

Then convert each one to binary:
24 (hex) = 36 (decimal) = 00100100 (binary)
65 (hex) = 101 (decimal) = 01100101 (binary)

and substituting the binary equivalent of "242465" in the above string yields:
001001000010010001100101...

Hex is from 0 - 15 (or 0-F). Binary follows a pattern of 0 and 1. So for two places: 00, 01, 10, 11.

Hex - Binary

0 = 0000
1 = 0001
2 = 0010
3 = 0011

4 = 0100
5 = 0101
6 = 0110
7 = 0111

8 = 1000
9 = 1001
A = 1010
B = 1011

C = 1100
D = 1101
E = 1110
F = 1111

If I add spaces it is easier to see the pattern:

Hex - Binary

0 = 00 00
1 = 00 01
2 = 00 10
3 = 00 11

4 = 01 00
5 = 01 01
6 = 01 10
7 = 01 11

8 = 10 00
9 = 10 01
A = 10 …

cgeier 187 Junior Poster

Are you using a touchscreen or an actual mouse? Are you sure that the "buttons" you are trying to operate are actually clickable or are they images (with no clickable components)?

Have you tried searching for: flight simulator x panels

to find a panel that may work as you desire?

Here is a product that claims to allow you to create/edit panels:
FS Panel Studio

cgeier 187 Junior Poster

What operating system? Is this an in-house program or a publically available program? If publically available, what is it called? If in-house, please post a screen shot. The following may be of use:

SendInput function

keybd_event function
Note: This function has been superseded. It is recommended to use SendInput instead.

mouse_event function
Note: This function has been superseded. It is recommended to use SendInput instead.

SetFocus function

GetWindowText function

GetClassName function

EnumWindows function

EnumChildWindows function

Process Class

PInvoke

This is not an exhaustive list of the functions that you may need, but some to get you started. Researching the above should lead you to any other ones you may need.

cgeier 187 Junior Poster

SQL Server connection strings

In addition, searching for one or more of the following should be helpful: SqlConnection, SqlCommand, DataTable, DataSet.

cgeier 187 Junior Poster

Your power adapter is probably not working. Try using a different power adapter.

cgeier 187 Junior Poster

It is probably a bad hard drive as @rubberman stated. However, not all diagnostic tools will necessarily find the issue--even the HP ones. I've had the best luck using Acronis True image. Try to make an image and if the hdd has bad sectors it will error out. I believe that both Seagate and WD offer a version of it for free--providing your hdd is a Seagate or a WD. The quickest way to find out if the hdd is the issue though, is to test the restore using a different hdd.

cgeier 187 Junior Poster

Btw, you don't look Swedish...hence my confusion earlier. :)

cgeier 187 Junior Poster

@JamesCherrill: "...why didn't OP see that Exception?"

I ran the code in NB, and it didn't throw an exception. It appears that while(input.hasNextDouble()) doesn't recognize the number as a double and just skips it.

Run the original code and mix numbers using "," (comma) as a decimal separator and numbers using "." (decimal) as the decimal separator in "orange.csv"

68.1
22.3
33,64

Then use the following:

Scanner input;

input  =  new Scanner(new FileInputStream ("C:\\javamapp\\orange.csv"));

while(input.hasNextDouble())  {                    

    double vikt = input.nextDouble();                                
    weight.add(vikt);
    System.out.println("read input: " + vikt);
}//while

Depending on what the decimal separator is set to, it will skip numbers that it doesn't see as doubles. If the decimal separator is set to "," (comma) it will skip numbers in the file with "." (decimal) as the decimal separator. If the decimal separator is set to "." (decimal), it will skip numbers in the file containing a "," (comma) as a decimal separator.

cgeier 187 Junior Poster

I have been able to replicate NaN in your originally posted code by the following.

Using locale = "en_US" -- English (United States), change numbers (in "orange.csv") to use "," (comma) instead of "." (decimal).

Using locale = "sv_SE" -- Swedish (Sweden), change the numbers (in "orange.csv") to use "." (decimal) instead of "," (comma).

To change locale:
Win 7:
-Start
-Control Panel
-View By: Small Icons
-Region and Language
-Click "Formats" tab
-For "Format", select desired format -- ex: English (United States) or Swedish (Sweden).
-Click "Additional settings" button
-Click "Numbers" tab
-Look at value for "Decimal symbol"

Note: English (United States) only has one choice -- "." Swedish (Sweden) has choice between "." and ","

To find out what the decimal separator on your computer is:

Add the following import statement:
import java.text.DecimalFormatSymbols;

Then:

DecimalFormatSymbols dfs = new DecimalFormatSymbols(); 
System.out.println("Decimal separator for your locale: " + dfs.getDecimalSeparator());

Resources:
Java 7 default locale

Decimal Separator in NumberFormat

cgeier 187 Junior Poster

Some of your comments in your program were in another language and your profile shows your location as Greece. Didn't really look like Greek, but I don't speak Greek so...

What country is the locale set to for the computer that you are using?

cgeier 187 Junior Poster

What do you mean by "...did you send that Greek numbers link?" It's something I found when searching for the decimal separator for Greek.

cgeier 187 Junior Poster

In my opinion the program shouldn't get to the point of NaN. You should check that the array contains data before trying to use it for computations.

I believe that the real issue may be the locale and input settings on your computer. In some European countries, the comma "," is used instead of decimal ".". Check the input language and locale settings on your computer. You may need to change the "." (decimal) to "," (comma) in "orange.csv"

Greek Numbers

..."Decimals: in Greek, the use of commas and periods is different than in English."

"Period is used to separate the thousands, while the comma is used as the decimal point."

cgeier 187 Junior Poster

Post the file "orange.csv". What is the range of numbers that is acceptable?

cgeier 187 Junior Poster

No need to repeat statements that are exactly the same. Just move them outside the if statements. Also, you don't need to use "&&", just order them from high numbers to low numbers (ex: 3999, 2999, 1999, 999, -1). Why remove the "\" only to add it back in. Additionally, LastIndexOf finds the last occurrence of "\", which may or may not be at the end of the path.

if (!path_img2.EndsWith(@"\"))
{
    path_img2 = path_img2 + @"\";
}//if

if (imageCounter_img2 > 999)
{
    path_img2 += "1";
}//if
else if (imageCounter_img2 > -1)
{
    path_img2 += "0";
}//else if

imageCounter_img2 = imageCounter_img2 - 1000;
dir_right.Text = path_img2;
imageno_right.Text = imageCounter_img2.ToString();
cgeier 187 Junior Poster

Looks like you figured it out. One comma is 2 dimensions. Three commas are 4 dimensions. Ensure your initialization matches your declaration.

cgeier 187 Junior Poster

Get rid of the second "=" sign. Also your declarations don't match. You have 3 commas, then only 2 commas (and dimensions) in the intialization. The following should work:

int [,] a =  new int [3,4]  { {2,3,4,5}, {34,56,25,67}, {22,44,55,77} };
cgeier 187 Junior Poster

Copying files in the foreground could make your application unresponsive. When running in the background, be aware that updating progress too frequently will have a performance impact on your operation. If only showing a progress bar, you may consider not updating every iteration, but rather every few iterations.

For i as Integer = 0 to 100

    If i Mod 5 = 0 Then
        'report progress

    End If
Next
cgeier 187 Junior Poster

You could create an additional table, called "NewUsers". Create a trigger that populates this table when a record is added (Alternatively, rather than using a trigger, your application could create an entry in "NewUsers" table when it adds a new user to the employee table.) You probably want to create one entry for each HR employee. So the primary key would be a combination of newUserEmpId and empId of each HR user (HREmpId). The application periodically checks this table. When an entry is found, a pop-up message occurs (or whatever other notification method you want to use. Maybe a form with a datagridview that shows new users). When the HR employee clicks "Acknowledge" (or "OK") delete the entry from "NewUsers" (for that particular HREmpId).

This should eliminate/reduce performance impact as it is checking a table with only a few rows, rather than the entire employee table.

Ex: NewUsers

EmpId HREmpId
------- ---------
255000 1234
255000 120001
255000 230122
255001 1234
255001 120001
255001 230122

In the above example, there are new new employees: 255000 and 255001. There are 3 HR employees that need to be notified: 1234, 120001, and 230122.

After HR employee 1234 acknowledges that he/she is now aware that new employee "255000" exists, the entry is deleted. The "NewUsers" table now looks like the following:

EmpId HREmpId
------- ---------
255000 120001
255000 230122
255001 1234
255001 120001
255001 230122

You could change HREmpId to an …

cgeier 187 Junior Poster

Another update. Added code to check that a session exists in Session Manager. It doesn't really check if the file exists in Session Manager, but rather checks for the .ini file that Session Manager creates. If a session exists in Session Manager, a ".ini" file should exist in %AppData%\VanDyke\Config\Sessions" with the name of the session (ex: Computer123.ini). Without this code, the script could hang due to a messagebox being open that says that the session couldn't be found.

cgeier 187 Junior Poster

Here is an updated copy of the above script. The previous version logged the error and then exited if it couldn't connect to a computer in the list. This version, logs the error and continues with other computers.

cgeier 187 Junior Poster

SecureCRT has built-in support for scripting.

Here are some resources:
Scripting Essentials: A Guide to Using VBScript in SecureCRT

Script Examples

Example Scripts for SecureCRT® for Windows

Table of Protocol-Specific Command-Line Options

Example: Read Data From Separate Hosts/Commands File And Log To Individual

How To Capture Command Output With ReadString() Using SecureCRT®

I had trouble getting "ReadString()" to work. I modified one of the scripts (.vbs) listed in the resources. I am attaching it. See the "ReadMe" in the .zip file for more info.

cgeier 187 Junior Poster

See the following for more connection string options. http://www.connectionstrings.com/excel/

I think Jet 4.0 driver only exists in 32-bit.

https://www.connectionstrings.com/using-jet-in-64-bit-environments/

cgeier 187 Junior Poster

I made a mistake in the code that I posted above.

Change from:

Dim retVal As Integer = 0

To:

Dim retVal As IntPtr = IntPtr.Zero

Additionally, when looking up a Win API definition, if you see a parameter with "Out" (or "In_Out"...or some version that contains the word "Out"), use "ByRef" instead of "ByVal" and ensure that the variable that you are passing it back to has been initialized. An example would be GetWindowRect.

<DllImport("user32.dll", EntryPoint:="GetWindowRect")>
Public Function GetWindowRect(ByVal hwnd As Integer, ByRef lpRect As Rectangle) As Boolean
End Function

Usage:

Dim winRect As New Rectangle
GetWindowRect(hwnd, winRect)

where "hwnd" is the handle to a window.

cgeier 187 Junior Poster

Here are a few things that you can try:

First of all it is necessary to check the data type definitions for both VB6 and VB .NET:

VB6 Data Types

VB .NET Data Types

One thing to note is that in VB6 a Long is 4 bytes. In VB .NET an Integer is 4 bytes.

In VB .NET an Integer = Int32 which is 4 bytes. A Long = Int64 which is 8 bytes.

Another thing to note is that an "IntPtr" in 32-bit OS is 4 bytes, and in a 64-bit OS is 8 bytes.

Use "IntPtr" instead of Integer, Int32, Long, Int64 (and "UIntPtr" instead of "UInteger", "UInt32", "ULong", "UInt64").

When you see "String" in a pInvoke (Win32) api, replace it with "System.Text.StringBuilder"

Convert VB6 "Type" to "Structure", but use "StructLayout".

The following article references C#, but also applies to VB .NET:
Mastering C# structs

"...If you change the definition of the struct to:"

<StructLayout(LayoutKind.Sequential, Pack:=1)>
Public Structure YourStructureName

End Structure

Note: Above code edited--converted from C# to VB .NET

"...This is what you need to work with most of the structures defined in the Windows API and C/C++..."

To use "StructLayout", add the following imports statement: "Imports System.Runtime.InteropServices".

Before specifying the data types for the parameters it is necessary to look at the definition of the Win API that you want to use. For example, look at GetClassName (see "Windows Data Types" at the end of this …

cgeier 187 Junior Poster

Store info in a text file or XML file. If you don't want the user to change the info, encrypt it. Add option to re-generate default file (system admin info) in case it gets corrupted.

cgeier 187 Junior Poster

Here is a post that may be useful.

cgeier 187 Junior Poster

I suggest you start by writing pseudo code. Then ...create a class named person.

cgeier 187 Junior Poster

As an alternative, laptop hard drives typically have lower power needs than desktop hard drives. You could probably get a laptop hdd and a 2.5" to 3.5" mounting adapter and put that in your current computer. Just be sure to compare the power requirement between brands before purchasing.

cgeier 187 Junior Poster

I also became curious. So I timed the execution. On my computer, the method that uses subtraction (as posted above) averaged 600 ms. Then one that uses multiplication averaged 0 ms.

Check it out:

Method 1:

private static String isOddOrEvenMultiply(int num)
{
    double tempNumDbl = (double)num * 0.5;
    int tempNumInt = (int)tempNumDbl;
    double tempNumSubDbl = tempNumDbl - tempNumInt;
    int lastDigit = (int)(tempNumSubDbl * 2.0);

    if (lastDigit == 0)
    {
      return "even";
    }
    else
    {
        return "odd";
    } 
}

Method 2:

Note: Some minor modifications were made to the below method. See above for the original supplied by @TylerD75.

private static String isOddOrEvenSubtract(int num)
{        
    int i = num;

    while (i > 2)
    {
        i -= 2;
    }

    if ( i == 1 )
    {
        return "odd";
    }
    else
    {
        return "even";
    }
}

So, for testing, I added a couple of methods that contain loops. I also added some code to time the execution as well.

Add some variables to hold the elapsedTime:

private static long multiplyElapsedTime = 0;
private static long subtractElapsedTime = 0;

runSubtract:
Note: The following will run 50 iterations.

private static void runSubtract()
{
    long startTime = System.currentTimeMillis();

    for (int i = Integer.MAX_VALUE; i > Integer.MAX_VALUE - 50; i--)
    {
        System.out.println("num: " + i + " " + isOddOrEvenSubtract(i));
    }//for

     long endTime = System.currentTimeMillis();
    subtractElapsedTime = endTime - startTime;

    //System.out.println("Elapsed time (subtraction): " + subtractTotalTime);

    //test with negative numbers
    for (int i = 0; i > -10; i--)
    { …
cgeier 187 Junior Poster

@Tarek_2: That might be ok for small numbers, but what about when you approach Integer.MaxValue (2,147,483,647)?

cgeier 187 Junior Poster

'@' means the string following is literal. Either remove the '@' or remove one of the '\'.

cgeier 187 Junior Poster

You're being somewhat cryptic. The name of the program would be useful. Also a screen shot of the window may be useful. Additionally, how much time do you spend each day copying data from the screen?

cgeier 187 Junior Poster

Do you have sleep/hibernation disabled (or set to "Allow wake timers") on the workstation? Are you able to rdp to this workstation from any other computer (on the same side of the router or remotely)?

Check value of the following registry keys on workstation:

  • HKEY_Local_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-TCP\PortNumber

Check that workstation is listening on the port:

  • netstat -anp TCP

should see something like 0.0.0.0:3389 (where 3389 is the PortNumber from the registry key)

When you attempt to connect are you typing "Domain\username" or "username"? Try both.

Are you connecting remotely using the IP Address? If you are connecting locally (inside the network), do you use the the IP Address or name? (When on a domain, you may have to type: name.local)

Resource:
Remote Desktop for Windows 8

Enabling Remote Desktop

cgeier 187 Junior Poster

The answer may depend on where you are trying to get the data from. Web browser? Java applet? Word? etc...

cgeier 187 Junior Poster

Are you using all of the standard OEM components? Or did you upgrade other things such as the video card? Video cards can use lots of power. If you upgraded the video card, there may not be any excess power left.

cgeier 187 Junior Poster

Change lines 40-42

from:

i += 1
TextBox1.Text = dt.Rows(i)(0)
TextBox2.Text = dt.Rows(i)(1)

to:

'last index is dt.Rows.Count - 1
'only increment if doing so
'would not exceed the index
If i < dt.Rows.Count - 2 Then
    i += 1
Else
    'set to the last row
    i = dt.Rows.Count - 1
End If

If dt IsNot Nothing Then
   TextBox1.Text = dt.Rows(i)(0)
   TextBox2.Text = dt.Rows(i)(1)
End If
Ashveen96 commented: i tried it, still same error +0
cgeier 187 Junior Poster

If you are going check the last character of a string, you could convert to binary and then just check for "0" or "1".

    public static String isOddOrEven(int num)
    {

        String binaryStr = Integer.toBinaryString(num);      
        if (binaryStr.charAt(binaryStr.length() - 1) == '0')
        {
            return "even";
        }
        else
        {
            return "odd";
        }    
    }

Is this a homework assignment? If so, I think that you're missing the point of the lesson. What is the current subject matter? Some possible lessons that are trying to be taught are:

  • Numeric approximation, rounding, truncation
  • Arithmetic overflow
  • Arithmetic underflow

The following will (eventually) result in an invalid result because of the effects of numeric approximation, rounding and truncation:

private static String isOddOrEven10(int num)
{
    String result = "";

    double tempNumDbl = (double)num * 0.1;

    int tempNumInt = (int)tempNumDbl;

    double tempNumSubDbl = tempNumDbl - tempNumInt;

    int lastDigit = (int)(tempNumSubDbl * 10.0);


    //int lastDigit = (int)((tempNumDbl - (int)tempNumDbl) * 10.0);

    switch(lastDigit)
    {
        case 0:
            result = "even";
            break;
        case 2:
            result = "even";
            break;
        case 4:
            result = "even";
            break;
        case 6:
            result = "even";
            break;
        case 8:
            result = "even";
            break;
        default:
            result = "odd";
    }//switch

    return result;
}

Output:

Num: 41
41.0 x 0.1 = 4.1
(int)4.1 = 4
4.1 - 4 = 0.10000000000000053
0.10000000000000053 x 10.0 = 1.0000000000000053
(int)1.0000000000000053 = 1

Result: 1 is odd, so 41 is odd.

Num: 42
42.0 x 0.1 = 4.2
(int)4.2 = 4
4.2 - 4 = …

cgeier 187 Junior Poster

In "frmBirthdayCake_Load", the connection is not open. Where is con.Open?

Ashveen96 commented: i tried it, still same error +0
cgeier 187 Junior Poster

In Visual Studio, you will save yourself some headaches if you build the program first before clicking "Start Debugging".

  • Click Build (in menu)
  • Select Rebuild <project name> (or Rebuild Solution)

Then, run the program in the debugger:

  • Click "Debug"
  • Select "Start Debugging"

It isn't required, but when you have errors, it makes it easier to figure out if it is a compiler error or a runtime error.

Additionally, you may be interested in changing some of the options. Not sure what version you are using but likely have some similar options. In 2010,

To turn on line numbers:

  • Click "Tools" (in menu)
  • Select "Options"
  • Expand "Text Editor"
  • Click "All Languages"
  • Check "Line numbers"

Then you can use "Ctrl-G" to jump to a line number.

To change default project location:

  • Click "Tools" (in menu)
  • Select "Options"
  • Click "Projects and Solutions"
  • Change value of "Projects location"
cgeier 187 Junior Poster

Use Nltest to test trust relationship
nltest

nltest /server:<server name> /sc_query:<domain name>

nltest /server:<server name> /sc_verify:<domain name>

/sc_query: <DomainName>
Reports on the state of the secure channel the last time that you used it. (The secure channel is the one that the NetLogon service established.) This parameter lists the name of the domain controller that you queried on the secure channel, also.

/sc_verify: <DomainName>
Checks the status of the secure channel that the NetLogon service established. If the secure channel does not work, this parameter removes the existing channel, and then builds a new one. You must have administrative credentials to use this parameter. This parameter is only valid on domain controllers that run Windows 2000 with Service Pack 2 and later.

cgeier 187 Junior Poster

Here are a few ideas:

Ensure that "Don't allow connections to this computer" is not selected (on workstation)

Open "System Properties"

  • Win-logo-key + R (or in Charms, select "Select Apps", type "run")
  • type: "control.exe sysdm.cpl"

Then:

  • Select "Remote" tab
  • Change/verify settings for "Remote Desktop"

If you made changes, re-test your connection.

Reset computer account

  • On Server, open the Active Directory Users and Computers console
  • Select the "Computers" container.
  • Right click on the computer that you are having trouble with. Select the Reset Account command from the shortcut menu.
  • When you do, you will see a prompt asking you if you are sure that you want to reset the computer account. Click Yes and the computer account will be reset.

Alternatives:
Netdom resetpwd

Powershell Reset-ComputerMachinePassword

After resetting the computer account, perform a backup of the workstation.

Re-join workstation to domain.
Trust Relationship Between Workstation and Domain Fails

If the Secure Channel is Broken between Domain controller and workstations
...A common cause of broken secure channel [machine account password] is that the secure channel password held by the domain member does not match that held by the AD. Often, this is caused by performing a Windows System Restore (or reverting to previous backup or snapshot) on the member machine, causing an old (previous) machine account password to be presented to the AD...

Resolution:
Most simple resolution would be unjoin/disjoin the computer from the domain and rejoin the computer account back to the …

cgeier 187 Junior Poster

What is your level of experience? Are you new to programming? If so, you need to start with the basics.

C# Fundamentals for Absolute Beginners: (06) Declaring Variables and Assigning Values Duration

Note: The below code should exist inside a method.

ex:

MessageBox.Show(GetCrypt("Hello World"));

or

string var1 = GetCrypt("Hello World");
MessageBox.Show(var1);
cgeier 187 Junior Poster

Did you receive that error on compiling? Make sure you have the following using statement:

  • using System.Security.Cryptography;

Note: You may have to add "System.Security" as a reference.

System.Security.Cryptography Namespace

cgeier 187 Junior Poster

C# seems to be more popular and you will find it easier to find posts on C#. Additionally, the structure of C# is similiar to Java, making it easier to learn Java if you decided you wanted to learn Java one day.

cgeier 187 Junior Poster

jRadioButton1, jRadioButton2, jRadioButton3 don't exist in "groupButton". They are only in the constructor.

cgeier 187 Junior Poster

Also n % 2 is modulus division. Here, it only = 0 for mulitiples of 2.

Ex: 2, 4, 6, 8, 10, etc...

Modulus division is the remainder part of dividing two numbers.

ex:

5 / 2 = 2 remainder 1

so, 5 % 2 = 1