I have a method
public void mybutton_click(object sender ,eventArgs e){
textblock.text=1;
}
public String mymethod(){
if(textlock.text==1){
return "mixture ";
}
else {
return "fixed";
}
}
problem is when i try to return the values from mymethod to a timer event I get the error
Not all code paths return a value .
how do i resolve so as to return a value from mymethod
Eric ZimmermanPosted Feb 11, 2014, 1:06 AM
1. Not sure if it matters, but typo on "textlock" instead of "textblock".
2. Possible problems with comparison between string and int.
3. In the mybutton_click event callback, I would set a member variable rather than using text
public void mybutton_click(object sender ,eventArgs e)
{
{
{
{
Eric ZimmermanPosted Feb 13, 2014, 11:26 PM
solomon mwikaPosted Feb 13, 2014, 8:41 AM
{
String thatword;
wordstype = mymenu.CheckWords();
String myword;
if (wordstype == "Fixed")
{
thatword = ourwords.words(5);
tlbRandomWords.Text = thatword;
myword = tlbRandomWords.Text;
if (myword.ToString().ToUpper() == tlbuser.Text && tlbuser.Text != "")
{
counter++;
tlbuser.Text = "";
MessageBox.Show(counter.ToString());
}
}
VulpesPosted Feb 10, 2014, 10:39 AM