49 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using AR;
 | |
| 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 Project.Dialog
 | |
| {
 | |
|     public partial class fSelectDataList : Form
 | |
|     {
 | |
|         public string SelectedValue = string.Empty;
 | |
|         public fSelectDataList(string[] list)
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             this.listBox1.Items.Clear();
 | |
|             foreach (var item in list)
 | |
|                 this.listBox1.Items.Add(item);
 | |
|             this.KeyDown += FSelectDataList_KeyDown;
 | |
|         }
 | |
| 
 | |
|         private void FSelectDataList_KeyDown(object sender, KeyEventArgs e)
 | |
|         {
 | |
|             if (e.KeyCode == Keys.Escape) this.Close();
 | |
|         }
 | |
| 
 | |
|         private void fSelectDataList_Load(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void button1_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (this.listBox1.SelectedIndex < 0)
 | |
|             {
 | |
|                 UTIL.MsgE("Please select an item\n\nPress ESC key or close button to cancel");
 | |
|                 return;
 | |
|             }
 | |
|             this.SelectedValue = this.listBox1.Items[this.listBox1.SelectedIndex].ToString();
 | |
|             this.DialogResult = DialogResult.OK;
 | |
| 
 | |
|         }
 | |
|     }
 | |
| }
 | 
