Click here to Skip to main content
15,897,891 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionInsert Row In Excel File Pin
hitesh sojitra15-May-08 0:36
hitesh sojitra15-May-08 0:36 
AnswerRe: Insert Row In Excel File Pin
parth.p15-May-08 0:59
parth.p15-May-08 0:59 
GeneralRe: Insert Row In Excel File Pin
hitesh sojitra15-May-08 1:29
hitesh sojitra15-May-08 1:29 
GeneralRe: Insert Row In Excel File Pin
hitesh sojitra15-May-08 1:48
hitesh sojitra15-May-08 1:48 
GeneralRe: Insert Row In Excel File Pin
hitesh sojitra15-May-08 1:55
hitesh sojitra15-May-08 1:55 
Questiondata binding update problem Pin
asha_s15-May-08 0:33
asha_s15-May-08 0:33 
AnswerRe: data binding update problem Pin
Mycroft Holmes15-May-08 19:44
professionalMycroft Holmes15-May-08 19:44 
QuestionCatching an exception from a control Pin
Steven J Jowett14-May-08 22:33
Steven J Jowett14-May-08 22:33 
I have created a control that is basically an TextBox with an extra property of RegularExpression

Public Class RegExTextBox<br />
Inherits from Windows.Forms.TextBox<br />
<br />
Private _sRegEx As String<br />
<br />
Public Property RegularExpression() As String<br />
Get<br />
Return _sRegEx<br />
End Get<br />
Set(ByVal Value As String)<br />
_sRegEx<br />
End Set<br />
End Property<br />


After text has been entered then text is then validated against the provided Regular Expression

Private Sub RegExTextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave<br />
        If Not System.Text.RegularExpressions.Regex.IsMatch(MyBase.Text, _sRegularExpression) Then<br />
            Throw New TextDoesNotMatchRegularExpressionException()<br />
        End If<br />
    End Sub


The problem that I am not sure how to trap the error on the form that consumes the RegExTextBox.

The only solutions I could come up with is to have another readonly property the returns true or false depending on whether the text is valid

Public ReadOnly Property IsValidText() As Boolean<br />
        Get<br />
            Return System.Text.RegularExpressions.Regex.IsMatch(MyBase.Text, _sRegularExpression)<br />
        End Get<br />
    End Property


Then delete the Leave event handler from the control and test the IsValidText property at form level.

Any guidance is appricated

Thanks

Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)

AnswerRe: Catching an exception from a control Pin
Chinners15-May-08 0:55
Chinners15-May-08 0:55 
GeneralRe: Catching an exception from a control Pin
Steven J Jowett15-May-08 1:08
Steven J Jowett15-May-08 1:08 
QuestionCompressing in vb .net 2003 Pin
aphei14-May-08 22:23
aphei14-May-08 22:23 
AnswerRe: Compressing in vb .net 2003 Pin
Steven J Jowett14-May-08 22:50
Steven J Jowett14-May-08 22:50 
AnswerRe: Compressing in vb .net 2003 Pin
Steven J Jowett14-May-08 23:07
Steven J Jowett14-May-08 23:07 
QuestionVB 6 question, Pin
nitin314-May-08 20:57
nitin314-May-08 20:57 
AnswerRe: VB 6 question, Pin
helelark12315-May-08 3:34
helelark12315-May-08 3:34 
QuestionSelect Multiple File in Single Open File Dialog Box Pin
TeiUKei14-May-08 20:52
TeiUKei14-May-08 20:52 
AnswerRe: Select Multiple File in Single Open File Dialog Box Pin
Ajay.k_Singh14-May-08 21:06
Ajay.k_Singh14-May-08 21:06 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
TeiUKei14-May-08 21:24
TeiUKei14-May-08 21:24 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
Ajay.k_Singh14-May-08 21:39
Ajay.k_Singh14-May-08 21:39 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
TeiUKei14-May-08 22:25
TeiUKei14-May-08 22:25 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
Ajay.k_Singh14-May-08 22:31
Ajay.k_Singh14-May-08 22:31 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
TeiUKei14-May-08 22:38
TeiUKei14-May-08 22:38 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
Ajay.k_Singh14-May-08 22:50
Ajay.k_Singh14-May-08 22:50 
GeneralRe: Select Multiple File in Single Open File Dialog Box Pin
TeiUKei14-May-08 22:59
TeiUKei14-May-08 22:59 
QuestionCna we have Nested Try and Catch IN VB 2005 Pin
nishkarsh_k14-May-08 20:22
nishkarsh_k14-May-08 20:22 

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.