-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrmGoto.cs
More file actions
78 lines (71 loc) · 2.32 KB
/
frmGoto.cs
File metadata and controls
78 lines (71 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
namespace NotepadSharp
{
public partial class frmGoto : Form
{
readonly ResourceManager LocRM = new ResourceManager("NotepadSharp.frmGoto", typeof(frmGoto).Assembly);
private int _lineGoto;
public int lineGoto
{
get => _lineGoto;
set
{
_lineGoto = value;
txtLine.Text = value.ToString();
}
}
public frmGoto(int lineNumber)
{
InitializeComponent();
lineGoto = lineNumber;
}
private void btnGoto_Click(object sender, EventArgs e)
{
try
{
if (Int32.Parse(txtLine.Text) <= 0)
{
MessageBox.Show(this, string.Format(LocRM.GetString("errorSubmit"), Int32.Parse(txtLine.Text)),
LocRM.GetString("$this.Text"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
lineGoto = Int32.Parse(txtLine.Text);
DialogResult = DialogResult.OK;
Close();
}
catch (OverflowException eX)
{
MessageBox.Show(this, string.Format(LocRM.GetString("overflowError"), txtLine.Text),
LocRM.GetString("$this.Text"),MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void frmGoto_Load(object sender, EventArgs e)
{
MultiLanguage.LoadLanguage(this, typeof(frmGoto));
txtLine.SelectAll();
}
private void txtLine_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar))
{
var Sender = (TextBox)sender;
controlToolTip.Show(LocRM.GetString("errorTyping"), Sender);
e.Handled = true;
}
}
}
}