vb.net - Opendialog box > Select txt file > display contents into a text box -
sorry if sounds dumb question. i'm trying open txt file using button (open dialog). display results of the text file textbox (that can edit values) after hit button called save writes text file.
is possible?
option strict on option explicit on imports system.io imports system public class form1 private sub form1_load(sender object, e eventargs) handles mybase.load end sub private sub button1_click(sender object, e eventargs) handles button1.click dim fd openfiledialog = new openfiledialog() dim strfilename string fd.title = "open file dialog" fd.initialdirectory = "c:\" fd.filter = "all files (*.*)|*.*|all files (*.*)|*.*" fd.filterindex = 2 fd.restoredirectory = true if fd.showdialog() = dialogresult.ok strfilename = fd.filename end if end sub private sub textbox1_textchanged(sender object, e eventargs) handles textbox1.textchanged end sub private sub button2_click(sender object, e eventargs) handles button2.click end sub end class
- reading file
when fd.showdialog() = dialogresult.ok
, need read file , load contents textbox. @steve provided link shows reading part; load textbox
- textbox1_textchanged()
not sure need when triggered
- if need save same file, through button2_click?
@steve provided link shows how to; read textbox.
do read every linked item on page; it's worthwhile. you'll have information you'll need , use several dozens of times in future.
Comments
Post a Comment