ADXCommandBarEdit

Add-in Express™ Support Service
That's what is more important than anything else

ADXCommandBarEdit
checking a ADXCommandBarEdit value 
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
Posted 20 Jun, 2005 10:59:29 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
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
Posted 20 Jun, 2005 11:27:02 Top
Jonathan Dorling




Posts: 31
Joined: 2005-06-14
thanks for that
Posted 20 Jun, 2005 11:38:25 Top