I assume that you already know how to get the data from your database to datatable (since you already display records in the UI), but if you don't, there are plenty of tutorials and code examples around that you can read up. So I just bypass that part for now.
Let's say you have a datatable filled with data, and to export that data to a text file as fixed length record text file, you will need to know what's the length for each field.
Use a stringbuilder object to build your output and when done, you write it to a file. Something like this:
Code:
Dim sb as new system.text.stringbuilder()
For Each row as datarow in table.Rows
     'suppose field0 is type string and is 20 chars in length, so we 
     'make it 20 chars long by padding blank spaces to the right
     sb.Append(row(0).ToString.PadRight(20)) 

     'suppose field1 is type integer and is 5 chars in length, so we 
     'make it 5 chars long by padding 0's to the left (leading zero's)
     sb.Append(row(1).ToString.PadLeft(5, "0")

     'Keep doing it for all the fields
     .....
     'Then finally, append a newline to complete the record
     sb.Append(Environment.Newline())
Next
'Once you get out of the loop, you output is ready to be written to a file
IO.File.WriteAllText("C:\test.txt", sb.ToString)
Note: It depends on what's your record specification is that you choose iether padrigth or padleft on each field.... But generally, all numeric values are padleft with 0's (leading zero's won't change the value of a number) and string is padright with blank spaces.