摘要:// MainForm.cs
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Globalization;using System.Text;using System.Windows.Forms;
namespace XGenerator{ public partial class MainForm : Form { IFormatProvider formatter = new NumberFormatInfo();
public MainForm() { InitializeComponent();
#if DEBUG tbMin.Text = "874"; tbMax.Text = "142857";#endif }
private void btnGenerate_Click(object sender, EventArgs e) { int minValue, maxValue; if (!int.TryParse(tbMin.Text, out minValue) || !int.TryParse(tbMax.Text, out maxValue) || minValue > maxValue) { rtbResult.Text = string.Format("Please fill the two text boxes correctly."); return; }
string min = minValue.ToString(formatter), max = maxValue.ToString(formatter); if (minValue == maxValue) { rtbResult.Text = min; // == max return; }
int minLength = min.Length, maxLength = max.Length; StringBuilder result = new......[
阅读全文]