Good afternoon,
I am an absolute beginner in C# so please be gentle. I have created a windows form in C# but I need the following VBA code converted so I can use it in my form. Any ideas where I start? I cant find the equivalent of Instr for C#
Sub clipboard()
Dim clipboard As MSForms.DataObject
Dim strContents As String
Set clipboard = New MSForms.DataObject
clipboard.GetFromClipboard
strContents = clipboard.GetText
If InStr(1, strContents, "TFR") > 0 Then
ErrorType = "TFR"
var1 = WorksheetFunction.Find("ERROR", strContents)
var2 = WorksheetFunction.Find("TFR", strContents, var1)
var3 = WorksheetFunction.Find("'", strContents, var2)
var4 = WorksheetFunction.Find("'", strContents, var3 + 1)
ErrorIdent = Trim(Mid(strContents, var3 + 1, var4 - var3 - 1))
End If
Sheet1.Cells(2, 4) = ErrorType
Sheet1.Cells(2, 6) = ErrorIdent
End Sub