Problems in C# Code (Noob)

Problems in c# code (Noob)

The problem is in the

age = Console.Read();

well, Console.Read() reads one symbol only - character 2 in your case that´s 50 int, and you have

  '2' - 12 == 38 // '2' == 50

remedy: read the whole string which is "21" in your case

  String line = Console.ReadLine(); 

then parse it into integer:

  // Parse() is the simplest; TryParse() is a better: 
// what if a user entered "bla-bla-bla"?
age = int.Parse(line);

Problems in c# code (Noob)

The problem is in the

age = Console.Read();

well, Console.Read() reads one symbol only - character 2 in your case that´s 50 int, and you have

  '2' - 12 == 38 // '2' == 50

remedy: read the whole string which is "21" in your case

  String line = Console.ReadLine(); 

then parse it into integer:

  // Parse() is the simplest; TryParse() is a better: 
// what if a user entered "bla-bla-bla"?
age = int.Parse(line);

Noob Concern: Problems making a new void method. C#

Make sure the method is inside a class, and that the class/property/other method braces before and after the method line up. Also make sure that the previous statement has a ; (semicolon).

This problem normally occurs because you have mismatched braces before the method or you have a missing semi-colon:

Correct

namespace A
{
public class AA
{
public string B {get; set; }
public string C {get; set; }
public void ShowD()
{
DoSomething;
}

}
}

Incorrect

namespace A
{
public class AA
{
public string B { get; set; }
public string C {get; set; // <--Note missing brace)
public void ShowD()
{
DoSomething;
}

}
}

Possible noob issue about radio buttons and xml in c#

i would bind the IsChecked property of the CheckBoxes to a enum property in your viewmodel. If your enum property changed, you edit the source property for your richtextbox and call a PropertyChanged for it.

    private RadioButtonEnum _radioButtonEnum
public RadioButtonEnum RadioButtonEnum
{
get { return _radioButtonEnum; }
set
{
_radioButtonEnum = value;
OnPropertyChanged("RadioButtonEnum");
RefreshText();
}
}

private void RefreshText()
{
switch (RadioButtonEnum)
{
case None:
//Do your changes to your TextProperty
break;
case All:
//Do your changes to your TextProperty
break;
case One:
//Do your changes to your TextProperty
}
OnPropertyChanged("YourTextProperty");
}

C#- Console Program Ideas for Noob

I'm a big fan of Halo, and one of the first things I did with C# was write an application that downloaded and parsed my online gaming stats while playing Halo 2. From there, I loaded all of the information into a database and redisplayed it in ASP.NET. In retrospect, the code was horrendous, but it was a fun exercise.

Another exercise was to parse the XML file for my iTunes music library, load it into a database, and (of course) display bits of it in ASP.NET.

Anyway, find ways to work with things you enjoy, be it games, music, television, or whatever.

QBSDK Noob Issue with SDK and samples

Am I missing something? The error message is "Quickbooks can't start because it is already running". So the problem is not with the path - according to this message.

Exit Quickbooks and possibly reboot the computer.

Ok. Sorry to state the obvious! This page suggests that this was an error in QB 2011 that was fixed in 2012. A little digging may uncover a fix for QB 2011 Premium.

Alternatively, it might be UAC control. Temporarily reduce the level of UAC to nothing to discover if this is the cause.

Added: The third option is to disable Quickbooks Instant Start in QBs Preferences, which keeps QB running as a background process. Reboot the computer after this change.

C# beginner error - "not all code paths return a value"

You forgot to return the final string.

private string encrypt(string toEncrypt)
{
string step1 = MD5(toEncrypt + "example");
string step2 = MD5("example" + step1);
string final = MD5("example" + step2 + "example");

return final;
}


Related Topics



Leave a reply



Submit