Click here to Skip to main content
15,892,298 members
Home / Discussions / C#
   

C#

 
AnswerRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 4:37
S. Senthil Kumar6-Dec-05 4:37 
GeneralRe: using regex to find part of a string Pin
melanieab6-Dec-05 5:09
melanieab6-Dec-05 5:09 
GeneralRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 5:16
S. Senthil Kumar6-Dec-05 5:16 
GeneralRe: using regex to find part of a string Pin
melanieab6-Dec-05 5:47
melanieab6-Dec-05 5:47 
GeneralRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 6:00
S. Senthil Kumar6-Dec-05 6:00 
GeneralRe: using regex to find part of a string Pin
melanieab6-Dec-05 7:39
melanieab6-Dec-05 7:39 
GeneralRe: using regex to find part of a string Pin
S. Senthil Kumar6-Dec-05 20:36
S. Senthil Kumar6-Dec-05 20:36 
QuestionCustom Controls And Events Pin
rich_wenger6-Dec-05 3:48
rich_wenger6-Dec-05 3:48 
I've go a Custom Control that inherits from the TextBox class and I've added a ListBox; I needed to create a custom event exposed to the parent form that would fire when the ListBox changed visiblity. The code below works but I know it's now quite right. Any help appreciated.

Control Code Snippet==============================================

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

public delegate void ListBoxEvent();

namespace TextBoxLookupLib
{
///
/// Custom Textbox Control
///

public class TextBoxLookup : System.Windows.Forms.TextBox
{
private System.Windows.Forms.ListBox listBox1;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public event ListBoxEvent ListBoxVisibleChanged;


public TextBoxLookup()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitComponent call
this.listBox1.Visible = false;
this.listBox1.Width = this.Width;
this.listBox1.TabStop = false;
this.DoubleClick +=new EventHandler(TextBoxLookup_DoubleClick);
this.listBox1.DoubleClick +=new EventHandler(listBox1_DoubleClick);
this.listBox1.VisibleChanged +=new EventHandler(listBox1_VisibleChanged);
ListBoxVisibleChanged += new ListBoxEvent(OnListBoxVisibleChanged);
}


///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}

#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.listBox1 = new System.Windows.Forms.ListBox();
//
// listBox1
//
this.listBox1.Location = new System.Drawing.Point(17, 17);
this.listBox1.Name = "listBox1";
this.listBox1.TabIndex = 0;
}
#endregion

private void OpenListBox()
{
Control ctlParent = this.Parent;
ctlParent.Controls.Add(this.listBox1);
this.listBox1.Width = this.Width;
this.listBox1.BringToFront();
this.listBox1.Visible = true;

}
private void CloseListBox()
{
this.Focus();
this.listBox1.Visible = false;
this.listBox1.SendToBack();
this.Refresh();
}
private void TextBoxLookup_DoubleClick(object sender, EventArgs e)
{
this.OpenListBox();
}
private void listBox1_DoubleClick(object sender, EventArgs e)
{
this.CloseListBox();
}
private void listBox1_VisibleChanged(object sender, EventArgs e)
{
ListBoxVisibleChanged();
}

public void OnListBoxVisibleChanged()
{
//Why this method call?
}
}
}


Form Code Snippet=============================================

this.textBoxLookup1.ListBoxVisibleChanged +=new ListBoxEvent(textBoxLookup1_ListBoxVisibleChanged);


private void textBoxLookup1_ListBoxVisibleChanged()

{

if(this.textBoxLookup1.ListSelectedValue != null)

this.textBox1.Text = this.textBoxLookup1.ListSelectedValue;

}




"She folds her legs...in doing so I glimpse Xanadu."--Gilby
QuestionAutoRedraw Pin
Sabry19056-Dec-05 2:47
Sabry19056-Dec-05 2:47 
Question.NET Remoting and recorded sound? Pin
mikker_1236-Dec-05 1:27
mikker_1236-Dec-05 1:27 
Questiondll Pin
ambedkar6-Dec-05 1:26
ambedkar6-Dec-05 1:26 
AnswerRe: dll Pin
Colin Angus Mackay6-Dec-05 1:51
Colin Angus Mackay6-Dec-05 1:51 
Questionalgorithm for 6 digits unique number Pin
Ronen Tidhar6-Dec-05 1:12
Ronen Tidhar6-Dec-05 1:12 
AnswerRe: algorithm for 6 digits unique number Pin
Colin Angus Mackay6-Dec-05 1:19
Colin Angus Mackay6-Dec-05 1:19 
AnswerRe: algorithm for 6 digits unique number Pin
J4amieC6-Dec-05 2:25
J4amieC6-Dec-05 2:25 
GeneralRe: algorithm for 6 digits unique number Pin
Ronen Tidhar7-Dec-05 1:07
Ronen Tidhar7-Dec-05 1:07 
GeneralRe: algorithm for 6 digits unique number Pin
Ronen Tidhar7-Dec-05 1:51
Ronen Tidhar7-Dec-05 1:51 
GeneralRe: algorithm for 6 digits unique number Pin
Dan Neely7-Dec-05 2:09
Dan Neely7-Dec-05 2:09 
GeneralRe: algorithm for 6 digits unique number Pin
Nick Hounsome8-Dec-05 22:40
Nick Hounsome8-Dec-05 22:40 
QuestionAre parameter arrays CLS compliant? Pin
Nish Nishant6-Dec-05 1:02
sitebuilderNish Nishant6-Dec-05 1:02 
AnswerRe: Are parameter arrays CLS compliant? Pin
S. Senthil Kumar6-Dec-05 1:22
S. Senthil Kumar6-Dec-05 1:22 
GeneralRe: Are parameter arrays CLS compliant? Pin
Nish Nishant6-Dec-05 2:32
sitebuilderNish Nishant6-Dec-05 2:32 
QuestionDataTime Pin
papa19806-Dec-05 0:55
papa19806-Dec-05 0:55 
AnswerRe: DataTime Pin
Colin Angus Mackay6-Dec-05 1:17
Colin Angus Mackay6-Dec-05 1:17 
GeneralRe: DataTime Pin
papa19806-Dec-05 1:23
papa19806-Dec-05 1:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.