vb.net - VB hidden button on form -


i using vb search data text file , populate in excel. it's working. problem xl.visible=true makes excel sheet visible @ once & values keep on populating. want hide excel till data population complete. make button appear on form when clicked, display excel file.

please help. here code i'm using:

 private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click      ' create excel instance     dim xl = microsoft.visualbasic.createobject("excel.application")     xl.visible = false     dim wb = xl.workbooks.add()     dim sheet = wb.activesheet      ' find lines starting whitepace followed mtv or mtb , capture     ' text after =     dim pattern = "(?<=\s*(mtv).*=).*"      dim = 1     dim arg = {microsoft.visualbasic.controlchars.crlf, microsoft.visualbasic.controlchars.lf}       if richtextbox3.text = ""         msgbox("no input. process??")          else         timer1.start()             each line in file.readlines(richtextbox3.text)                 dim match = regex.match(line, pattern)                 ' check each line , fill sheet              if match.success                 sheet.cells(i, 1).value = match.value                 += 1             end if         next     end if      xl.visible = true   end sub 

use button2 excel work remove line: xl.visible = true

put button on form called button3 (or named whatever); set button3 property visible = false. @ bottom of button2 click event put button3.visible = true

after button2 gets clicked you'll have button3 visible. in button3 click event put xl.visible = true

to make work, you'll need declare "xl" module or class variable. put dim xl object above sub , remove dim inside sub; it.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -