© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
Gijs

✅ C# webforms counting problem

Hey I'm new to c# I have been working with c# for 3 days now but I stummbeld on a problem I can't get fixed

public int counter = 3;

MessageBox.Show("You have" + counter - 1 + "Tries left");
public int counter = 3;

MessageBox.Show("You have" + counter - 1 + "Tries left");


once I do this I get the error: Operator '-' cannot be applied to operands of type 'string' and 'int'. And I have no idea how to fix it. It's probarlly something really simple but I just can't seem to get it
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ ✅ C# Academy Calculator Project Challenge -- Counting Times Used
C#CC# / help
3y ago
❔ C# Recursion Output problem
C#CC# / help
3y ago
❔ Easy problem C# Unity
C#CC# / help
3y ago