Skale
asked on
How do i remove index out of bounds at string array in vb.net
I'm using below code to split my filename and get into string array after that i'm writing them to datagridview. In here if it's index out of bound for example filenameArr(2) is not existing how can i show it simple "-" string value.
Dim filename As String = Path.GetFileNameWithoutExtension(str)
Dim filenameArr() As String = filename.Split(New String() {"__"}, StringSplitOptions.None)
dgv.Rows.Add(obj.name, filenameArr(0), filenameArr(1), filenameArr(2), filenameArr(3), filenameArr(4))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.