The line of code that sets up writing to the file:
file = My.Computer.FileSystem.OpenTextFileWriter("C:\pdata\New folder\" & fileDateTime, True)
Is within the If statement for the default button. This code is never hit when you use the other button. You need this to be outside the if block, or copied into the If block for the other button.