vb.net - Visual Basic Advanced Browser -


i creating browser in visual basic, having problem saving settings. in advanced options, under privacy tab have browser retain settings after closing window. if click "never remember password", , close window, settings not stored. also, when type url in, after searching url not updated correctly.

does have ideas how can make these parts of project work? new coding, tips or ideas add browser welcomed , appreciated see functional.

thank you! :d

form 1

imports system.net imports system.io   public class magycka  private declare sub keybd_event lib "user32" (byval volumeupordown byte, byval v1 byte, byval v2 integer, byval v3 integer)  private sub magycka_formclosing(sender object, e formclosingeventargs) handles me.formclosing      file.delete("c:\magycka\history.txt")      each link string in history.lsthistory.items         file.appendalltext("c:\magycka\history.txt", link & vbnewline)     next      each favoritename string in lstname.items         file.appendalltext("c:\magycka\favoritename.txt", favoritename & vbnewline)     next      each favoriteurl string in lsturl.items         file.appendalltext("c:\magycka\favoriteurl.txt", favoriteurl & vbnewline)     next  end sub  private sub tmrdate_tick(sender object, e eventargs) handles tmrdate.tick     lbltime.text = datetime.now.tostring end sub  private sub form1_load(sender object, e eventargs) handles mybase.load      cmbsearchengine.items.add("google")     cmbsearchengine.items.add("google images")     cmbsearchengine.items.add("youtube")      cmbsearchengine.selectedindex = 0      addtab(tabcontrol1)      try         dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag         txturl.text = browser.url.tostring     catch ex exception     end try       if my.settings.homepageorblankpage = 0         dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag         browser.navigate(my.settings.homepage)     else     end if      try          history.visible = false         each link string in file.readalllines("c:\magycka\history.txt")             history.lsthistory.items.add(link.tostring)         next     catch ex exception     end try      try         each url string in file.readalllines("c:\magycka\favoriteurl.txt")             listbox3.items.add(url)         next     catch ex exception     end try      try         listbox3.selectedindex = 0     catch ex exception     end try      try         each name string in file.readalllines("c:\magycka\favoritename.txt")             dim newbookmark new toolstripbutton             newbookmark.text = name              newbookmark.tag = listbox3.selecteditem.tostring             tsbookmarks.items.add(newbookmark)             listbox3.selectedindex = listbox3.selectedindex + 1          next     catch ex exception     end try      createdbookclick()  end sub    private sub txturlsearchengines_keyup(sender object, e keyeventargs) handles txturlsearchengines.keyup      dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag      select case (cmbsearchengine.selectedindex)         case 0             if e.keycode = keys.enter                 browser.navigate("https://www.google.com/#q=" + txturlsearchengines.text)             end if         case 1             if e.keycode = keys.enter                 browser.navigate("https://www.google.com/search?site=imghp&tbm=isch&source=hp&biw=1366&bih=661&q=" + txturl.text)             end if         case 2             if e.keycode = keys.enter                 browser.navigate("https://www.youtube.com/results?search_query=" + txturlsearchengines.text)             end if     end select end sub  private sub txturl_keyup(sender object, e keyeventargs) handles txturl.keyup     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     if e.keycode = keys.enter         browser.navigate(txturl.text)     end if end sub  private sub btnback_click(sender object, e eventargs) handles btnback.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.goback() end sub  private sub btnforward_click(sender object, e eventargs) handles btnforward.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.goforward() end sub  private sub brnrefresh_click(sender object, e eventargs) handles brnrefresh.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.refresh() end sub  private sub btnurl_click(sender object, e eventargs) handles btnurl.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.navigate(txturl.text) end sub  private sub btnvolumeup_click(sender object, e eventargs) handles btnvolumeup.click     call keybd_event(system.windows.forms.keys.volumeup, 0, 0, 0) end sub  private sub btnvolumedown_click(sender object, e eventargs) handles btnvolumedown.click     call keybd_event(system.windows.forms.keys.volumedown, 0, 0, 0) end sub  private sub btnmute_click(sender object, e eventargs) handles btnmute.click     call keybd_event(system.windows.forms.keys.volumemute, 0, 0, 0) end sub  private sub optionstoolstripmenuitem_click(sender object, e eventargs) handles optionstoolstripmenuitem.click     advancedoptions.show() end sub  private sub viewhistorytoolstripmenuitem_click(sender object, e eventargs) handles viewhistorytoolstripmenuitem.click     history.show() end sub  private sub btnhome_click(sender object, e eventargs) handles btnhome.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.navigate(my.settings.homepage) end sub  private sub btnsearch_click(sender object, e eventargs) handles btnsearch.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     select case (cmbsearchengine.selectedindex)         case 0             browser.navigate("https://www.google.com/#q=" + txturlsearchengines.text)         case 1             browser.navigate("https://www.google.com/search?site=imghp&tbm=isch&source=hp&biw=1366&bih=661&q=" = txturlsearchengines.text)         case 2             browser.navigate("https://www.youtube.com/results?search_query=" + txturlsearchengines.text)     end select end sub  private sub newtabtoolstripmenuitem_click(sender object, e eventargs) handles newtabtoolstripmenuitem.click     addtab(tabcontrol1) end sub  private sub closetabtoolstripmenuitem_click(sender object, e eventargs) handles closetabtoolstripmenuitem.click     removetab() end sub  public sub addtab(byref tabcontrol tabcontrol)     dim browser new webbrowserfunction     dim tab new tabpage     browser.tag = tab     tab.tag = browser     tabcontrol1.tabpages.add(tab)     tab.controls.add(browser)     browser.dock = dockstyle.fill     browser.navigate(my.settings.homepage)      tabcontrol1.selectedtab = tab  end sub public sub addtabfromhistory(byref tabcontrol tabcontrol, byref link string)      dim browser new webbrowserfunction     dim tab new tabpage     browser.tag = tab     tab.tag = browser     tabcontrol1.tabpages.add(tab)     tab.controls.add(browser)     browser.dock = dockstyle.fill     browser.navigate(link)      tabcontrol1.selectedtab = tab  end sub  public sub removetab()     if tabcontrol1.tabpages.count <> 0         tabcontrol1.tabpages.remove(tabcontrol1.selectedtab)     end if end sub  private sub tabcontrol1_selectedindexchanged(sender object, e eventargs) handles tabcontrol1.selectedindexchanged     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag      try         txturl.text = browser.url.tostring     catch ex exception     end try end sub  private sub newtoolstripmenuitem_click(sender object, e eventargs) handles newtoolstripmenuitem.click     dim newwindow new magycka     newwindow.show() end sub  private sub undotoolstripmenuitem_click(sender object, e eventargs) handles undotoolstripmenuitem.click     txturl.undo() end sub  private sub redotoolstripmenuitem_click(sender object, e eventargs) handles redotoolstripmenuitem.click     txturl.clearundo() end sub  private sub cuttoolstripmenuitem_click(sender object, e eventargs) handles cuttoolstripmenuitem.click     txturl.cut() end sub  private sub copytoolstripmenuitem_click(sender object, e eventargs) handles copytoolstripmenuitem.click     txturl.copy() end sub  private sub pastetoolstripmenuitem_click(sender object, e eventargs) handles pastetoolstripmenuitem.click     txturl.paste() end sub  private sub selectalltoolstripmenuitem_click(sender object, e eventargs)     txturl.selectall() end sub  private sub savesourcecodetoolstripmenuitem_click(sender object, e eventargs) handles savesourcecodetoolstripmenuitem.click     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag     dim filename string = inputbox("enter filename:", "save html", ".txt")     dim path string = "c:\magycka\" & filename      try         if file.exists(path)             dim alltext string             alltext = browser.documenttext             file.writealltext(path, alltext)         else             file.create(path).dispose()             dim alltext string             alltext = browser.documenttext             file.writealltext(path, alltext)         end if     catch ex exception      end try end sub  private sub addbookmarks()     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag     dim newbookmark new toolstripbutton      newbookmark.text = tabcontrol1.selectedtab.text     newbookmark.tag = browser.url     tsbookmarks.items.add(newbookmark)     lstname.items.add(tabcontrol1.selectedtab.text)     lsturl.items.add(browser.url.tostring)      addhandler newbookmark.click, addressof newbookmarkclick   end sub  private sub newbookmarkclick(sender object, e eventargs)     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag      if typeof sender toolstripbutton         browser.navigate(ctype(sender, toolstripbutton).tag)     end if end sub  private sub createdbookclick()     each item toolstripbutton in tsbookmarks.items         addhandler item.click, addressof bookclick     next end sub  private sub bookclick(sender object, e eventargs)     txturl.text = ctype(sender, toolstripbutton).tag     booknav() end sub  private sub booknav()     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag     browser.navigate(txturl.text) end sub  private sub bookmarkpagetoolstripmenuitem_click(sender object, e eventargs) handles bookmarkpagetoolstripmenuitem.click     addbookmarks() end sub  end class 

advanced options

imports system.net imports system.io   public class magycka  private declare sub keybd_event lib "user32" (byval volumeupordown byte, byval v1 byte, byval v2 integer, byval v3 integer)  private sub magycka_formclosing(sender object, e formclosingeventargs) handles me.formclosing      file.delete("c:\magycka\history.txt")      each link string in history.lsthistory.items         file.appendalltext("c:\magycka\history.txt", link & vbnewline)     next      each favoritename string in lstname.items         file.appendalltext("c:\magycka\favoritename.txt", favoritename & vbnewline)     next      each favoriteurl string in lsturl.items         file.appendalltext("c:\magycka\favoriteurl.txt", favoriteurl & vbnewline)     next  end sub  private sub tmrdate_tick(sender object, e eventargs) handles tmrdate.tick     lbltime.text = datetime.now.tostring end sub  private sub form1_load(sender object, e eventargs) handles mybase.load      cmbsearchengine.items.add("google")     cmbsearchengine.items.add("google images")     cmbsearchengine.items.add("youtube")      cmbsearchengine.selectedindex = 0      addtab(tabcontrol1)      try         dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag         txturl.text = browser.url.tostring     catch ex exception     end try       if my.settings.homepageorblankpage = 0         dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag         browser.navigate(my.settings.homepage)     else     end if      try          history.visible = false         each link string in file.readalllines("c:\magycka\history.txt")             history.lsthistory.items.add(link.tostring)         next     catch ex exception     end try      try         each url string in file.readalllines("c:\magycka\favoriteurl.txt")             listbox3.items.add(url)         next     catch ex exception     end try      try         listbox3.selectedindex = 0     catch ex exception     end try      try         each name string in file.readalllines("c:\magycka\favoritename.txt")             dim newbookmark new toolstripbutton             newbookmark.text = name              newbookmark.tag = listbox3.selecteditem.tostring             tsbookmarks.items.add(newbookmark)             listbox3.selectedindex = listbox3.selectedindex + 1          next     catch ex exception     end try      createdbookclick()  end sub    private sub txturlsearchengines_keyup(sender object, e keyeventargs) handles txturlsearchengines.keyup      dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag      select case (cmbsearchengine.selectedindex)         case 0             if e.keycode = keys.enter                 browser.navigate("https://www.google.com/#q=" + txturlsearchengines.text)             end if         case 1             if e.keycode = keys.enter                 browser.navigate("https://www.google.com/search?site=imghp&tbm=isch&source=hp&biw=1366&bih=661&q=" + txturl.text)             end if         case 2             if e.keycode = keys.enter                 browser.navigate("https://www.youtube.com/results?search_query=" + txturlsearchengines.text)             end if     end select end sub  private sub txturl_keyup(sender object, e keyeventargs) handles txturl.keyup     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     if e.keycode = keys.enter         browser.navigate(txturl.text)     end if end sub  private sub btnback_click(sender object, e eventargs) handles btnback.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.goback() end sub  private sub btnforward_click(sender object, e eventargs) handles btnforward.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.goforward() end sub  private sub brnrefresh_click(sender object, e eventargs) handles brnrefresh.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.refresh() end sub  private sub btnurl_click(sender object, e eventargs) handles btnurl.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.navigate(txturl.text) end sub  private sub btnvolumeup_click(sender object, e eventargs) handles btnvolumeup.click     call keybd_event(system.windows.forms.keys.volumeup, 0, 0, 0) end sub  private sub btnvolumedown_click(sender object, e eventargs) handles btnvolumedown.click     call keybd_event(system.windows.forms.keys.volumedown, 0, 0, 0) end sub  private sub btnmute_click(sender object, e eventargs) handles btnmute.click     call keybd_event(system.windows.forms.keys.volumemute, 0, 0, 0) end sub  private sub optionstoolstripmenuitem_click(sender object, e eventargs) handles optionstoolstripmenuitem.click     advancedoptions.show() end sub  private sub viewhistorytoolstripmenuitem_click(sender object, e eventargs) handles viewhistorytoolstripmenuitem.click     history.show() end sub  private sub btnhome_click(sender object, e eventargs) handles btnhome.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     browser.navigate(my.settings.homepage) end sub  private sub btnsearch_click(sender object, e eventargs) handles btnsearch.click     dim browser webbrowserfunction = me.tabcontrol1.selectedtab.tag     select case (cmbsearchengine.selectedindex)         case 0             browser.navigate("https://www.google.com/#q=" + txturlsearchengines.text)         case 1             browser.navigate("https://www.google.com/search?site=imghp&tbm=isch&source=hp&biw=1366&bih=661&q=" = txturlsearchengines.text)         case 2             browser.navigate("https://www.youtube.com/results?search_query=" + txturlsearchengines.text)     end select end sub  private sub newtabtoolstripmenuitem_click(sender object, e eventargs) handles newtabtoolstripmenuitem.click     addtab(tabcontrol1) end sub  private sub closetabtoolstripmenuitem_click(sender object, e eventargs) handles closetabtoolstripmenuitem.click     removetab() end sub  public sub addtab(byref tabcontrol tabcontrol)     dim browser new webbrowserfunction     dim tab new tabpage     browser.tag = tab     tab.tag = browser     tabcontrol1.tabpages.add(tab)     tab.controls.add(browser)     browser.dock = dockstyle.fill     browser.navigate(my.settings.homepage)      tabcontrol1.selectedtab = tab  end sub public sub addtabfromhistory(byref tabcontrol tabcontrol, byref link string)      dim browser new webbrowserfunction     dim tab new tabpage     browser.tag = tab     tab.tag = browser     tabcontrol1.tabpages.add(tab)     tab.controls.add(browser)     browser.dock = dockstyle.fill     browser.navigate(link)      tabcontrol1.selectedtab = tab  end sub  public sub removetab()     if tabcontrol1.tabpages.count <> 0         tabcontrol1.tabpages.remove(tabcontrol1.selectedtab)     end if end sub  private sub tabcontrol1_selectedindexchanged(sender object, e eventargs) handles tabcontrol1.selectedindexchanged     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag      try         txturl.text = browser.url.tostring     catch ex exception     end try end sub  private sub newtoolstripmenuitem_click(sender object, e eventargs) handles newtoolstripmenuitem.click     dim newwindow new magycka     newwindow.show() end sub  private sub undotoolstripmenuitem_click(sender object, e eventargs) handles undotoolstripmenuitem.click     txturl.undo() end sub  private sub redotoolstripmenuitem_click(sender object, e eventargs) handles redotoolstripmenuitem.click     txturl.clearundo() end sub  private sub cuttoolstripmenuitem_click(sender object, e eventargs) handles cuttoolstripmenuitem.click     txturl.cut() end sub  private sub copytoolstripmenuitem_click(sender object, e eventargs) handles copytoolstripmenuitem.click     txturl.copy() end sub  private sub pastetoolstripmenuitem_click(sender object, e eventargs) handles pastetoolstripmenuitem.click     txturl.paste() end sub  private sub selectalltoolstripmenuitem_click(sender object, e eventargs)     txturl.selectall() end sub  private sub savesourcecodetoolstripmenuitem_click(sender object, e eventargs) handles savesourcecodetoolstripmenuitem.click     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag     dim filename string = inputbox("enter filename:", "save html", ".txt")     dim path string = "c:\magycka\" & filename      try         if file.exists(path)             dim alltext string             alltext = browser.documenttext             file.writealltext(path, alltext)         else             file.create(path).dispose()             dim alltext string             alltext = browser.documenttext             file.writealltext(path, alltext)         end if     catch ex exception      end try end sub  private sub addbookmarks()     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag     dim newbookmark new toolstripbutton      newbookmark.text = tabcontrol1.selectedtab.text     newbookmark.tag = browser.url     tsbookmarks.items.add(newbookmark)     lstname.items.add(tabcontrol1.selectedtab.text)     lsturl.items.add(browser.url.tostring)      addhandler newbookmark.click, addressof newbookmarkclick   end sub  private sub newbookmarkclick(sender object, e eventargs)     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag      if typeof sender toolstripbutton         browser.navigate(ctype(sender, toolstripbutton).tag)     end if end sub  private sub createdbookclick()     each item toolstripbutton in tsbookmarks.items         addhandler item.click, addressof bookclick     next end sub  private sub bookclick(sender object, e eventargs)     txturl.text = ctype(sender, toolstripbutton).tag     booknav() end sub  private sub booknav()     dim browser webbrowserfunction = tabcontrol1.selectedtab.tag     browser.navigate(txturl.text) end sub  private sub bookmarkpagetoolstripmenuitem_click(sender object, e eventargs) handles bookmarkpagetoolstripmenuitem.click     addbookmarks() end sub  end class 

history

imports system.io  public class history  private sub history_formclosing(sender object, e formclosingeventargs) handles me.formclosing     e.cancel = true     me.visible = false      each link string in lsthistory.items         file.appendalltext("c:\magycka\history.txt", link & vbnewline)     next  end sub  private sub btnclearhis_click(sender object, e eventargs) handles btnclearhis.click     lsthistory.items.clear()     system.io.file.delete("c:\magycka\history.txt") end sub  private sub btnclosehis_click(sender object, e eventargs) handles btnclosehis.click     each link string in lsthistory.items         file.appendalltext("c:\magycka\history.txt", link & vbnewline)     next     close() end sub  private sub btndelete_click(sender object, e eventargs) handles btndelete.click     lsthistory.items.remove(lsthistory.selecteditem) end sub  private sub lsthistory_mousedoubleclick(sender object, e mouseeventargs) handles lsthistory.mousedoubleclick     magycka.addtabfromhistory(magycka.tabcontrol1, lsthistory.selecteditem.tostring)  end sub end class 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -