Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6972197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:56:14+00:00 2026-05-27T16:56:14+00:00

I’m getting two errors, I see where they are, I just don’t know how

  • 0

I’m getting two errors, I see where they are, I just don’t know how to change the code to fit my needs.

Here’s the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace zaidimas
{
    public partial class Form1 : Form
    {

        public int z1 = 1;
        public int z2 = 1;
        public int kauliukas;
        public string nuoroda;

        public Form1()
        {
            InitializeComponent();
            button2.Visible = false;
            button1.Visible = true;
            webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
            webBrowser1.Navigate("siauliaicity.99k.org/zaidimas/");
        }

        private void button1_Click(object sender, EventArgs e)
        {

            // Gaunama kauliuko reikšmė
                int kauliukas = RandomNumber(1, 6);
                pictureBox1.ImageLocation = kauliukas + ".jpg";
                label2.Text = "Kauliukas ridenos ridinėjosi ir sustojo ties" + kauliukas + "taškais";


                int z1 = z1 + kauliukas; (first error goes here)
                string nuoroda = "http://siauliaicity.99k.org/zaidimas/index.php?z=1&z1=" + z1 + "&z2=" + z2 + "&plus=" + kauliukas;
                webBrowser1.Navigate(nuoroda);
                button1.Visible = false;
                button2.Visible = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            // Gaunama kauliuko reikšmė
            int kauliukas = RandomNumber(1, 6);
            pictureBox1.ImageLocation = kauliukas + ".jpg";
            label2.Text = "Kauliukas ridenos ridinėjosi ir sustojo ties" + kauliukas + "taškais";

            int z2 = z2 + kauliukas; (second error goes here)
            string nuoroda = "siauliaicity.99k.org/zaidimas/index.php?z=2&z1=" + z1 + "&z2=" + z2 + "&plus=" + kauliukas;
            webBrowser1.Navigate(nuoroda);
            button1.Text = "Ridenti kauliuką! (Ridena: Pirmasis žaidėjas)";

            button2.Visible = false;
            button1.Visible = true;
        }

        // Kauliuko funkcija
        private int RandomNumber(int min, int max)
        {
            Random random = new Random();
            return random.Next(min, max);
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }
    }
}

Error message’s:

Error 1 Use of unassigned local variable ‘z1’ C:\Users\Tutis\Documents\Visual Studio 2008\Projects\zaidimas\zaidimas\Form1.cs 38 26 zaidimas

and

Error 2 Use of unassigned local variable ‘z2’ C:\Users\Tutis\Documents\Visual Studio 2008\Projects\zaidimas\zaidimas\Form1.cs 52 22 zaidimas

Any suggestions how to change the code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:56:15+00:00Added an answer on May 27, 2026 at 4:56 pm

    You have already declared variable with names z1 and z2 you cannot declare them again

    I think you wanted to use the same variable but you have accidently put int in start

    change

    int z1 = z1 + kauliukas; (first error goes here)
    

    to

    z1 = z1 + kauliukas; (first error goes here)
    

    and

     int z2 = z2 + kauliukas; (second error goes here)
    

    to

     z2 = z2 + kauliukas; (second error goes here)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.