Jonathan Dorling
Guest
|
just a quick question
i got a ADXCommandBarEdit in side a menu so it is a sub menu and basic i need to test that it is a Integer and in bigger then 50 and if it is not setfocus back to the ADXCommandBarEdit so a new number can be type in?
any code for this please?
Jonathan |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Jonathan, I think it is not impossible to manage focus of an edit control in Office. But you can show a message if the value is greater than 50.
See the code below.
Private Sub AdxCommandBarEdit1_Change(ByVal sender As Object) Handles AdxCommandBarEdit1.Change
Dim edit As AddinExpress.MSO.ADXCommandBarEdit = sender
Dim MyValue As Integer
If edit.Text <> String.Empty Then
Try
MyValue = Convert.ToInt32(edit.Text)
If (MyValue > 50) Or (MyValue < 0) Then
MessageBox.Show("The value is out of range.", AddinName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
If lastValue = 0 Then
edit.Text = String.Empty
Else
edit.Text = lastValue.ToString()
End If
Else
lastValue = MyValue
End If
Catch
If lastValue = 0 Then
edit.Text = String.Empty
Else
edit.Text = lastValue.ToString()
End If
End Try
End If
End Sub
|
|
Jonathan Dorling
Posts: 31
Joined: 2005-06-14
|
|