c# - Building a login with ASP.NET in VB -


i found youtube video on building website login asp.net problem is in c# have been converting vb when ran program got error

object reference not set instance of object.  description: unhandled exception occurred during execution of current web       request. please review stack trace more information error , originated in code.   exception details: system.nullreferenceexception: object reference not set instance of object.  source error:   source code generated unhandled exception can shown when compiled in debug mode. enable this, please follow 1 of below steps, request url:  1. add "debug=true" directive @ top of file generated error. example: 
or:  2) add following section configuration file of application:  <configuration> <system.web>    <compilation debug="true"/> </system.web> </configuration> 

i know means in c# can't find is. here code.

       imports system        imports system.collections.generic        imports system.linq        imports system.web        imports system.web.ui        imports system.web.ui.webcontrols        imports system.data.sqlclient        imports system.configuration    partial class registration inherits system.web.ui.page   protected sub submit_click(byval sender object, byval e system.eventargs) handles submit.click     dim con sqlconnection = new sqlconnection(configurationmanager.connectionstrings("regconnectionstring").connectionstring)     con.open()     dim inscmd string = "insert registration (username, password, emailaddress, fullname, country) values (@username, @password, @emailaddress, @fullname, @country)"     dim insertuser sqlcommand = new sqlcommand(inscmd, con)     insertuser.parameters.addwithvalue("@username", textboxun.text)     insertuser.parameters.addwithvalue("@password", textboxpass.text)     insertuser.parameters.addwithvalue("@emailaddress", textboxea.text)     insertuser.parameters.addwithvalue("@fullname", textboxfn.text)     insertuser.parameters.addwithvalue("@country", dropdownlistcountry.selecteditem.tostring())      try         insertuser.executenonquery()         con.close()         response.redirect("login.aspx")     catch ex exception         response.write("you have launched nuclear warhead , started wwiii seek shelter asap")      end try end sub  protected sub page_load(byval sender object, byval e system.eventargs) handles me.load      if (ispostback)           dim con sqlconnection = new sqlconnection(configurationmanager.connectionstrings("regconnectionstring").connectionstring)         con.open()          dim cmdstr string = "select count(*) registration username='" + textboxun.text + "'"          dim userexist sqlcommand = new sqlcommand(cmdstr, con)          dim temp integer = convert.toint32(userexist.executescalar().tostring())         con.close()          if temp = 1             response.write("username exist. please choose username")         end if     end if  end sub end class 

if see please let me know. thanks!

honestly thing step through , make sure nothing has "no value" , i'm not familiar if statement setup, i'd more comfortable =true or not(condition) rather ispostback, can't remember if answer defaults true i'd @ 2


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -