Use string.LastIndexOf to ID the final 'dot' and then string.Substring to change it:
Dim filename As String = "file.name.txt"
Dim lastDot As Integer = filename.LastIndexOf("."C)
filename = filename.Substring(0, lastDot) & "_" & filename.Substring(lastDot + 1)
You can use similar code to do the second task.