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

  • Home
  • SEARCH
  • 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 9209459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:50:52+00:00 2026-06-18T00:50:52+00:00

i am making an application which will load and save settings in an xml

  • 0

i am making an application which will load and save settings in an xml file. i searched thru all those questions and answers and tried all those methods and i didn’t find solution to my problem. here is the code:

private void DocumentToPrint_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
        int x1 = 1;            
        XmlReader reader = XmlReader.Create("settings.xml");
        while (reader.Read())
        {
            if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "coordinates"))
            {
                if (reader.HasAttributes)
                {
                    x1 = int.Parse(reader.GetAttribute("tekst1x"));
                }

            }
        }
        reader.Close();

        var line1 = textBox1.Text;
        Font PrintFont = this.textBox1.Font;
        SolidBrush PrintBrush = new SolidBrush(Color.Black);
        e.Graphics.DrawString(line1, PrintFont, PrintBrush, x1, 30, new StringFormat());
        PrintBrush.Dispose();
    }

so its always showing me

this error:

Use of unassigned local variable ‘x1’ even i do have x1 assigned to 1.

on this line

e.Graphics.DrawString(line1, PrintFont, PrintBrush, x1, 30, new StringFormat());

any help will be appreciated. thanks in advance and best wishes.

i edit the question and added the full 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-06-18T00:50:53+00:00Added an answer on June 18, 2026 at 12:50 am

    The given code does compile well. It seems like an issue with the IDE. I suppose it’ll be enough to Clean andRebuild the solution. However if it does not help, you may try to restart Visual Studio.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an application which will retrieve all mailboxes from Domino Server. And
I am making an application which will run automatically on phone start up. Now
I am making an application which will have an interface similar to Photoshop: multiple
I m making an application in ANDROID which will be used at two ends.
I am interested in making a decent WPF application which will be pretty huge.
I am making a application which will show data in table view. I am
I'm making an application in which I have to do XML parsing. I have
I am making an application which will act as a virtual printer saving the
I am making an application which will do something on receipt of a particular
I am making an application in which user will be making gestures on screens

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.