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 1042425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:30:26+00:00 2026-05-16T15:30:26+00:00

I need to add a form to my existing application i have it all

  • 0

I need to add a form to my existing application i have it all laid out but how do I get it to use the code from the form as to make it seamless. Any thoughts? and sorry for the wall of code just thought it might help.

The Validate button should get its info from the console like below

alt text

The Generate action should append the check digit like in this example
alt text

alt text

   public static void Main(string[] args)
    {
        Console.Write("Enter a valid 10 digit ISBN Number ");
        string isbn = isbnChecker.DestabilizeIsbn(Console.ReadLine()); // Normalizes the input and puts it on string "str"
        if (isbn.Length > 10 || isbn.Length < 9) // If the string length is greather than 10, or smaller than 9
        {
            Console.WriteLine("The number you have entered is not a valid ISBN try again."); // Print invalid number
            Console.ReadLine();
        }
        else if (isbn.Length == 10) // If the length is 10
        {
            if (isbnChecker.CheckNumber(isbn)) // If function CheckNum return "true"...
                Console.WriteLine("The number you have entered is a valid ISBN");

            else // If it returns "false"...
                Console.WriteLine("The number you have entered is not a valid ISBN try again.");
                Console.ReadLine();
        }
        else // Else (If the number is NOT greater than 10 or smaller than 9, NOR is it 10 -> If the number is 9)
        {
            Console.WriteLine("The Check digit that corresponds to this ISBN number is " + checkIsbnClass.CheckIsbn(isbn) + "."); // Print the checksum digit
            Console.ReadLine();
        }



    }



 public static class isbnChecker
    {
        public static bool CheckNumber(string isbn) // Checks if the checksum digit is correct
        {
            if (isbn[9].ToString() == checkIsbnClass.CheckIsbn(isbn)) // If the 10th digit of the number is the same as the calculated digit...
                return true;
            else // If they're not the same...
                return false;
        }
        public static string DestabilizeIsbn(string isbn) // replace the string
        {
            return isbn.Replace("-", "").Replace(" ", "");
        }
    }

  public static string CheckIsbn(string isbn) // Calculates the 10th digit of a 9-digits partial ISBN number
        {
            int sum = 0;
            for (int i = 0; i < 9; i++) // For each number...
            {
                sum += int.Parse(isbn[i].ToString()) * (i + 1); // ...Multiply the number by it's location in the string
            }
            if ((sum % 11) == 10) // If the remainder equals to 10...
            {
                return "x"; // Output X
            }
            else // If it does not equal to 10...
            {
                return (sum % 11).ToString(); // Output the number
            }
        }
      public static bool CheckNumber(string isbn) // Checks if the checksum digit is correct
        {
            if (isbn[9].ToString() == CheckIsbn(isbn)) // If the 10th digit of the number is the same as the calculated digit...
                return true;
            else // If they're not the same...
                return false;
        }
      public static string DestabilizeIsbn(string isbn) // replace the string
      {
          return isbn.Replace("-", "").Replace(" ", "");
      }

    }


public partial class IsbnForm : Form
{
    public IsbnForm()
    {
        InitializeComponent();
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        this.xInputTextBox.Text = "Enter a Valid ISBN";
    }
}

}

  • 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-16T15:30:26+00:00Added an answer on May 16, 2026 at 3:30 pm

    I’m not sure what you’re asking here. If you want the user to enter the ISBN in the form, then you’d do this:

    using (var frm = new IsbnForm())
    {
        var rslt = frm.ShowDialog();
        if (rslt == DialogResult.OK)
        {
            // Access property that gets the value the user entered.
        }
        else
        {
            // User canceled the form somehow, so show an error.
        }
    }
    

    If you want to display the form and have the entry field displaying the ISBN that the user entered on the command line, then you’ll need to add a property or method to the IsbnForm class so that you can set the value before displaying the form. That is, inside IsbnForm, add this property:

    public string Isbn
    {
        get { return xInputTextBox.Text; }
        set { xInputTextBox.Text = value; }
    }
    

    And then, to populate it:

    Console.Write("Enter an ISBN: ");
    var isbn = Console.ReadLine();
    using (var frm = new IsbnForm())
    {
        frm.Isbn = isbn;  // populates the field in the form.
        var rslt = frm.ShowDialog();
        // etc, etc.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form and I need to add some data from database before
I have an existing application (C#/Win forms). I need to add functionality to the
in C# forms I need code to add a second form to my existing.
I need to add annotations to existing HTML documents - best in the form
Hї! I have wrote test for my application. I need add item to database
I have an existing web2py application. Now I need to create a new registration
I have this PHP contact form which disallows a submission from an existing IP.
I want to add a new item into an existing form. I have the
I need add Auto complete on apex Tabular Form. there is a column as
I need to add a contact form to a website I'm making, and found

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.