This repository has been archived by the owner on Dec 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReplaceForm.cs
57 lines (49 loc) · 1.67 KB
/
ReplaceForm.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Ava
{
public partial class ReplaceForm : Form
{
// Static global variables
public static string targetString;
public static string replacementString;
public static bool canReplaceValue;
// Constructor
public ReplaceForm()
{
InitializeComponent();
// Set default values to the variables
targetString = "";
replacementString = "";
canReplaceValue = false;
}
// If the text in tbTarget changes, the targetString variable is updated
private void tbTarget_TextChanged(object sender, EventArgs e)
{
targetString = tbTarget.Text;
}
// If the text in tbReplacement changes, the replacementString variable is updated
private void tbReplacement_TextChanged(object sender, EventArgs e)
{
replacementString = tbReplacement.Text;
}
// If the btnReplace button is clicked, the targetString and the replacementString variables are updated
private void btnReplace_Click(object sender, EventArgs e)
{
targetString = tbTarget.Text;
replacementString = tbReplacement.Text;
if(targetString != "" && replacementString != "")
{
canReplaceValue = true;
}
}
protected void ReplaceForm_OnFormClosing(object sender, FormClosingEventArgs e) { Hide(); }
}
}