on 03-20-2018 1:21 PM
SAP 8.8
vb.net
How do I check to make sure another form is closed when I am performing actions on a different form?
In this instance I have another form that can not be open while I am using the update button on another form.
How do I check if for is open?
I usually use this function, you can find out if a specific form is open to prevent the user to open another one
public static bool IsFormOpen(string typeEx)
{
var count = [SAPAPPLICATION].Forms.Cast<IForm>().Count(p => p.TypeEx.Equals(typeEx));
return count > 0;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are a lot of code converters in the web, besides, it is a small code, you can use this as a base to your vb.net code since the changes are usually smalls.
Thank you for all your help in giving me the Idea I needed code converter did not help but I wrote the function as so:
Public Function IsFormOpen(ByVal typeEx As String) As Boolean
Dim formCounter(SBO_Application.Forms.Count) As Integer
Dim loopCount As Integer = 1
Do
formCounter(loopCount) = loopCount
If formCounter(loopCount) = SBO_Application.Forms.Count Then
Exit Do
End If
loopCount += 1
Loop
loopCount = 1
Dim formExistence As SAPbouiCOM.Form
While formCounter(loopCount) < SBO_Application.Forms.Count
Try
formExistence = SBO_Application.Forms.GetForm(typeEx, formCounter(loopCount))
If formExistence.TypeEx = typeEx And formExistence.Visible = True Then
Return False
End If
Catch ex As Exception
End Try
If loopCount <> formCounter.Length Then
loopCount += 1
End If
End While
Return True
End Function
Great that it helped 🙂
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.