|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
#31
|
||||
|
||||
|
Quote: Is this line correct? testIDtxt = Repeater1.Controls.(0).FindControl("testID") I tried to c&p it, but Intellisense doesn't accept: Repeater1.Controls.(0).FindControl("testID") Repeater1.Controls(0).FindControl("testID") Repeater1.Controls.FindControl("testID") ... |
|
#32
|
|||
|
|||
|
Quote:
Howzit, where there are curved brackets in VB you usually need square ones in C# when dealing with references. So your code would be more like: testIDtxt = Repeater1.Controls[0].FindControl("testID"); Repeater1.Controls[0].FindControl("testID"); Here's a link to help you in the future. You've got to be very careful using these converters though as they can really put you in a world of hurt if you just copy paste a lot of code. Search for "CodeTranslator: Free Code Translation From VB.NET <-> C#". I can't post the link cause i'm a new user. |
|
#33
|
|||
|
|||
|
I am connected to a ERP System Vantage table QuoteDtl. The code below is my attempt to update an existing QuoteDtl Record i.e., Line one (QuoteDtl) of the QuoteHed (Quote Header) record.
Dim edvCompany As EpiDataView = CType(oTrans.EpiDataViews("QuoteDtl"), EpiDataView) ‘<<< QuoteDtl is a PROGRESS Table in Vantage ERP System Dim dvOrdRel As DataView = edvCompany.dataView MessageBox.Show("After DIMS" & xlsDatei ) ‘ << I see this message Dim drv As DataRowView MessageBox.Show("B4 Update" & xlsDatei ) ‘<<< I See This Message ‘ <<<< *** ERROR Object reference not set to an instance of an object. 'drv("RowMod") = "A" drv("Company") = "HS" drv("QuoteNum") = 14357 drv("QuoteLine") = 1 drv("CustNum") = 11 drv("PartNum") = "*03-0199" drv("LineDesc") = "*03-0199 Description" drv("OrderQty") = 0 drv("Number01") = 3 drv("revisionNum") = "B-1" drv("ProdCode") = "Dominica" drv("SellingExpFactor") = 1 drv("Confidencepct") = 0 MessageBox.Show("After Field Sets" ) oTrans.Update() |
|
#34
|
|||
|
|||
|
I need help
I am new to .net I am having an issue with Object reference not set to instance of an object.
What i am trying to do is fill a label with data from my SQL db an example of what i have is Dim TA as new StyleDataTableAdpters.StyleTableAdtpter() Dim ID As Integer=StyleDDL.SelectedValue Dim Height as String Height=TA.HeightByID(ID) Heightlbl.Text= Height now this is part of a web form, For composing online fence estimates basically the user selects there fence style and the details of the style are set into the labels. I have debugged and in the watch it the error is in my insert But the look shows that all my insert parameters have data and none are null so I'm assuming that the code example above is the source to my error. I'm sorry if this is not clear I have only been doing this for a few months any help is appreciated. Thank You |
|
#35
|
||||
|
||||
|
the only candidate for null here is this:
StyleDDL.SelectedValue check in debug mode what is the selected value of your drop down list. if no luck, error messages of .NET always come with Stack Trace.. post it here and we'll help you track down the source of that error. |
|
#36
|
|||
|
|||
|
the styleDDL is not null it has a value, in debug mode all my parameters have sufficient data, nothing is null. My insert method i am using is successful in several other pages of my project. it only seems to be this page and one other page, and both pages I am using the same method to fill labels and get data from db for the labels. Maybe I will try another method of getting Data.
|
|
#37
|
|||
|
|||
|
Quote:
This is the Stack Trace Hope this is what you need. [NullReferenceException: Object reference not set to an instance of an object.] _Default.SubmitBtn_Click(Object sender, EventArgs e) in C:\Users\John\Documents\Visual Studio 2008\WebSites\MyProject\FenceEstimate.aspx.vb:96 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 |
|
#38
|
||||
|
||||
|
what is line 96 of the file FenceEstimate.aspx.vb?
also please post code for SubmitBtn_Click method from that file. |
|
#39
|
|||
|
|||
|
Quote:
Protected Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitBtn.Click ----->this in bold is line 96 Dim Save As FenceEstimate = Nothing "This FenceEtimate is a Vb class Called FenceEstimate it is where i defined the insert parameters" Dim poop As Boolean = False 'I know im in poop if this stays false. Save = New FenceEstimate(txtDate.Text, txtFname.Text, txtLName.Text, txtAdd1.Text, txtAdd2.Text, CitysDDL.SelectedValue, txtEmail.Text, txtPhone.Text, txtPhone2.Text, Stylelbl.Text, HeightLable.Text, txtLength.Text, txtLengthRemaove.Text, EarthDDL.SelectedItem.Text, SurfaceDDL.SelectedItem.Text, GradeDDL.SelectedItem.Text, FenceLineDDL.SelectedItem.Text, GatesDDL.SelectedItem.Text, Gate1DDL.SelectedItem.Text, Gate2DDL.SelectedItem.Text, Gate3DDL.SelectedItem.Text, WoodTypeLabel.Text, CapLabel.Text, txtCompleteDate.Text, InHomeDDL.SelectedValue, LabTotlbl.Text, MatTotlbl.Text, TotCostlbl.Text, Statuslbl.Text) poop = Save.InsertToDB() ------------------------------------------------------------ This is the entire App_Code FenceEstimate VB Page Public Class FenceEstimate Public DateOfEst As String = "" Public F_Name As String = "" Public L_Name As String = "'" Public Address1 As String = "" Public Address2 As String = "" Public City As String = "" Public Email As String = "" Public Phone As String = "" Public Phone2 As String = "" Public Style As String = "" Public Height As String = "" Public Length As String = "" Public LengthRemove As String = "" Public Earth As String = "" Public Surface As String = "" Public Level As String = "" Public FenceLine As String = "" Public NumGates As String = "" Public Gate1 As String = "" Public Gate2 As String = "" Public Gate3 As String = "" Public WoodType As String = "" Public CapStyle As String = "" Public DateBy As String = "" Public InHome As String = "" Public EstLabor As String = "" Public EstMat As String = "" Public EstTot As String = "" Public Status As String = "" Dim TA As New FenceStylesTableAdapters.FenceEstimatesTableAdapte r() Public Sub New(ByVal DateOfEst As String, ByVal F_Name As String, ByVal L_Name As String, ByVal Address1 As String, ByVal Address2 As String, ByVal City As String, ByVal Email As String, ByVal Phone As String, ByVal Phone2 As String, ByVal Style As String, ByVal Height As String, ByVal Length As String, ByVal LengthRemove As String, ByVal Earth As String, ByVal Surface As String, ByVal Level As String, ByVal FenceLine As String, ByVal NumGates As String, ByVal Gate1 As String, ByVal Gate2 As String, ByVal Gate3 As String, ByVal WoodType As String, ByVal CapStyle As String, ByVal DateBy As String, ByVal InHome As String, ByVal EstLabor As String, ByVal EstMat As String, ByVal EstTotal As String, ByVal Status As String) Me.DateOfEst = DateOfEst Me.F_Name = F_Name Me.L_Name = L_Name Me.Address1 = Address1 Me.Address2 = Address2 Me.City = City Me.Email = Email Me.Phone = Phone Me.Phone2 = Phone2 Me.Style = Style Me.Height = Height Me.Length = Length Me.LengthRemove = LengthRemove Me.Earth = Earth Me.Surface = Surface Me.Level = Level Me.FenceLine = FenceLine Me.NumGates = NumGates Me.Gate1 = Gate1 Me.Gate2 = Gate2 Me.Gate3 = Gate3 Me.WoodType = WoodType Me.CapStyle = CapStyle Me.DateBy = DateBy Me.InHome = InHome Me.EstLabor = EstLabor Me.EstMat = EstMat Me.EstTot = EstTot Me.Status = Status End Sub Public Function InsertToDB() As Boolean Dim Save As Integer Save = TA.InsertEstimate(DateOfEst, F_Name, L_Name, Address1, Address2, City, Email, Phone, Phone2, Style, Height, Length, LengthRemove, Earth, Surface, Level, FenceLine, NumGates, Gate1, Gate2, Gate3, WoodType, CapStyle, DateBy, InHome, EstLabor, EstMat, EstTot, Status) If Save > 0 Then Return True Else Return False End If End Function End Class Appreciate the help thanks this is my first site is complete all but theses errors. Also I see in the stack trace it is referencing to postData(second line from bottom of stack trace) I was at one point attempting to write a Public Sub Called postData which was meant to be used to fill the labels with Data from DB but i deleted that. I think that may have something to do with it. Thanks for the help it is appreciated |
|
#40
|
|||
|
|||
|
if you need any more info just ask once again i really appreciate the help.
|
|
#41
|
||||
|
||||
|
sorry, but if you insist your drop down lists have selected item which is not null,
I fear we're at dead end.. |
|
#42
|
|||
|
|||
|
I think so too. I am by far a programmer, and dont know too much this is my first project, before this i didnt even know html. Do you have any suggestions on aother method of placin data from a DB table into labels. thanks
|
|
#43
|
||||
|
||||
|
Quote:
issue and you're likely to get good help in there. |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > Common causes of: Object reference not set to an instance of an object error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|