DoEvents Returns "Value Cannot Be Null." Error?
Dec 6, 2003Code:
Application.DoEvents()
Error:
[code].....
Code:
Application.DoEvents()
Error:
[code].....
I have some code which gets child items for a menu via the GetChildren function which takes a list of menuData: Dim builtMenu As New List(Of MenuData)(_rawData.FindAll(Function(item) item.GroupingID = 0))
For Each menuData As MenuData In builtMenu
If menuData.Children IsNot Nothing Then
menuData.Children.AddRange(GetChildren(menuData))
End If
Next
If I check if menudata.children isnot nothing, it always is nothing because the GetChildren function is yet to run (providing the child items, which do exist). If I remove this check and just have this code:
Dim builtMenu As New List(Of MenuData)(_rawData.FindAll(Function(item) item.GroupingID = 0))
For Each menuData As MenuData In builtMenu
menuData.Children.AddRange(GetChildren(menuData))
Next
Then I am presented with a Object reference not set to an instance of an object error on menuData.Children.AddRange(GetChildren(menuData))
I am using vb.net sqlite.net and dblinq0.20.1 to search a sqlite table on a primary key field.My code looks like this
Dim blb = (From d In db.Data Where d.UID = myuid Select d).Single
This returns the error "Coalesce used with type that cannot be null" .If I search on a nullable field it works fine.
I have a WPF application that uses a third-party library to perform a specific task; this library, in one of its methods, executes the statement Assembly.GetEntryAssembly(). If I run the WPF application on debug (by running a .Net exe for testing) the library works properly and Assembly.GetEntryAssembly() returns a reference to the assembly of the executable, but in production I have a different situation that causes me some problems.
[Code]....
I have the following code in my application. When it is executed it brings out a null value at times, where i am sure there should be a value returned. I have checked by running the sql statement in the database and it returns the correct value. What could be wrong with my code? [Code]
View 6 RepliesRather interesting bit on this one, I have all the code where it should be working but whenever it hits parse1 it returns the file as null. [code] I probably just need a fresh pair of eyes because I'm not seeing where this is glitching (...or if it's just my computer in this case.)Rather annoying at this point, tried break points and following the execution to catch the error but no such luck.
View 2 RepliesI have some VB.NET code that creates a TransactionScope instance:
LoggingUtility.LogDebug("UpdateCallTable", "SatComCallDataImporter", "About to associate call data with contracts")
Using ts = New TransactionScope()
LoggingUtility.LogDebug("UpdateCallTable", "SatComCallDataImporter", "Getting all unimported SatCom calls")
My application is throwing an exception on the call to the creation of a new TransactionScope, with "Object reference not set to an instance of an object.". The exception isn't thrown on my development machine or my test machine; only on the customers production machine, and I have no idea why. I've placed debug lines immediately before and after this line so I'm positive it is this line causing the problem.
A have used TransactionScopes throughout the application and this is the only place throwing the exception on the client machine."About to associate call data with contracts" gets written to the log and the next log entry is the "Object reference not set to an instance of an object".
Code works fine if I move it out of a transaction.I've been struggling with this for 4 days now and have got no closer.
i hav two openfilefialogs(1 and 2). So i also have a listbox. the files opened with the openfiledialogs will be added to the listbox. and when i need to open the files i need to see if they are from which openfiledialog. so
it is like this.
Path.GetDirectoryName(OpenFileDialog1.FileName) & "" & Form3.ListBox1.SelectedItem.ToString
'if this returns a null then go to this
Path.GetDirectoryName(OpenFileDialog2.FileName) & "" & Form3.ListBox1.SelectedItem.ToString
Is their a more elegant way to assign a space to a value, if a database call returns null for a data set column? I am doing the following check which is pretty tedious:
If (ds.Tables("employee").Rows(0).Item("txtNamePrefix").IsDBNull(0)) Then
txtNamePrefix.Text = ""
Else
txtNamePrefix.Text = ds.Tables("employee").Rows(0).Item("txtNamePrefix")
End If
I have a DataGridView connected to a DataSet. I want to allow the user to update and insert new records on the RowLeave and CellLeave events. The Update method works:
Me.ExpensesTableAdapter.Update(Me.DataSet1.Expenses)
I am basically trying to access the CLSID portion of the registry... some CLSIDs are working, some arent...
Here is my code:
Dim regkey As RegistryKey
regkey = Registry.ClassesRoot.OpenSubKey("CLSID" & location & "InprocServer32", False) 'Just Returns null when im looking for a certain CLSID
Dim SubKeyvalues() As String = regkey.GetValueNames()
Dim subkeyvalue As String
subkeyvalue = regkey.GetValue(SubKeyvalues(0))
I'm converting a system of numerous programs from foxpro/foxweb/javascript to asp.net/vb/sql server.
I'm coding for a dropdownlist which is currently controlled via js.
I don't like using the control this particular way, but I want to maintain look and feel for the customer.
The control is initialized with some values via Page_Load() in behind code.[code]...
I'm trying to get data with the methods below and I get null response and can't figure out why. I'm just trying out a different way of using a wcf service from silverlight and I don't understand something that I should.[code]...
The employee object will stay null. If I put a break into the service call and follow through the code it finds the correct record from the database and the return statement shows an object with the correct data but still the employee object in silverlight side will remain null.
[Code]...
By my logic, this should only assign .length to index IF the length of strItem is longer than 0. This check is there in case the listbox is empty, or the user has not selected an item. However, everytime I go through this code without an item selected I get:
[Code]...
I have a several form elements that I am dynamically creating with javascript when a user changes a number value in a textbox, by filling the innerHTML of a div like so:
dfinnerhtml = dfinnerhtml + "<div class='field'> ";
dfinnerhtml = dfinnerhtml + "<textarea name='textbox1" + suffix + "' type='text' id='textbox1" + suffix + "' value='' rows='4' cols='20' class='field'></textarea> ";
dfinnerhtml = dfinnerhtml + "</div> ";
Then, in the aspx.vb code behind, when the user clicks the Save button, I run through a series of Requests to try and add the values that are in these form elements to a SQL string:
Dim DFTestValue1 As String DFTestValue1 = Request("textbox" & c.ToString)
where c is a loop counter to the # of textboxes created (the input value mentioned above that triggers the create) The problem here is that this code works in Internet Explorer but not in Firefox or Chrome. The Request() value returns null and nothing is saved. I hope I've explained this well enough.
I tried binding data to combobox at the runtime in the form load event. I had written the following bind function,
Private Sub BindComboBox()
Dim da As SqlDataAdapter
Dim conn As SqlConnection
Dim ds As DataSet = Nothing
[code]....
The problem is cboSubject.SelectedText is returning empty string.
I have a vb.net app that I can read a .xls file into a dataset or loop through as oledbdatareader and it gives the same result.Some of the rows have all nulls when I loop through them but if I open the same file in Microsoft Excel I can see that row fine.[code]From the info above the first two SKU values would come through fine but when I get to the 3rd row it would show a null.Is it possible that it kind of inherits the first rows type and since the 3rd row isn't all numeric if nulls it? [code]
View 1 RepliesI have a select statement which was returning the required values but when I changed the OS date from English(US) to English(UK), it now returns null. I believe the problem is concerned with date since in the query am selecting values where the date from the database is the same as the date in a combobox but I don't know what else I can do. It almost looks like the dates in the combox and in the database are not the same and yet the date in the combobox is actually retrieved from the database and has been returning values fine until I changed the system date format.Here's my select command:
cmd4.CommandText = _
"SELECT sum(brought_qtty), recieved_qtty from brought_coffee, centre_weigh where brought_date=#" & _
dtComb.Text.Trim & "#" & _[code].......
I am making use of a 3rd party dll and am encountering some strange behavior in VB, which doesn't occur in C# Perhaps someone can explain what is going on. Anyhow, I am making use of a method in this 3rd party library which accepts an array parameter ByRef. The end result is the variable should remain null after the method call, but it is returning initialized for some reason.
[Code]...
I am trying to create a treeview in VB.net, the data has to be loaded from MSAccess 2010 database. When I try to run this program I get error : Argument Null Exception was unhandled, 'column' argument cannot be null and the program crashes. I have pasted the code as under:
Imports System.Data.OleDb
Public Class frmRating
Private Sub frmRating_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
[code].....
I get #Error in reportviewer when I use the following expression:
=IIf(Fields!PaymentNumber.Value>0,
IPmt(Fields!Annual_Interest_Rate.Value/1200,
Fields!Payment.Value,
Fields!No_of_Monthly_Payments.Value,
Fields!Total_Amount_Financed.Value),0)
When I remove the IPmt() function and use some static value instead, it works. Is there a way to find out the exact error ?
access is denied error thought updateresource returns true value and i am running vb.net as admin
View 9 RepliesI have the following function:
Public Function CheckHasRoom(people_id As String, semester As String, year As String)
' Don't let folks already registered for a room register for another.
Dim RoomSelected As String
[Code]....
But it is bugging out at hasroom.Any() saying, "Input string was not in a correct format." Any thoughts on why? This is returning a collection of rows just like where I use this same code elsewhere without issue?
I've spent 2 days to figure this out, but no luck. I have an IIF expression what shows the correct value when the condition goes true (IPmt calculated), but the else always returns #error, although it should be just 0. =IIf(Fields!PaymentNumber.Value<>0,
[Code]...
I've been trying to get the UNC path for a mapped drive in a web application written in VB.net 2005. I was able to get this code working[code]...
I tested this code out in a test application - just a simple web page. But when I plug the code into my actual project, it doesn't work. In my testing of other examples, I figured out that WNetGetConnection returns a system error of 487 - ERROR_INVALID_ADDRESS. But I don't understand why it would work in my test application but not my actual project application.
In our code base there is a function which should return either an object or nothing. The exact code is this : Return NothingThe calling method looks something like thismyObj = theClass.function()if myObj <> nothing then // fails
View 1 RepliesWhen I try to save the picture and the picture is already existed it show an error
Me.Location = New System.Drawing.Point(50, 50) Create a new Bitmap object with the screen bounds Dim both As Bitmap = New Bitmap(166, 261, Imaging.PixelFormat.Format32bppArgb) Create a Graphics object that will process the screen shot front and back Dim bothgraph As Graphics = Graphics.FromImage(both) Copy the screen contents bothgraph.CopyFromScreen(0, 0, -506, -279, Screen.PrimaryScreen.Bounds.Size,opyPixelOperation.SourceCopy)' Save the resulting graphics
[Code]...
Ok, here is the problem,in vbscript, i was reading parts of streams
i.e.
teststrid = left (strLine,8)
teststrnm =rtrim( mid (strLine,15,30))
teststrx = mid (strLine,57,8)
teststr = left (strLine,3)
strFormcode = left (strLine, 10)
strSymmetrycode = left (strLine,14)
strSigncode = left (strLine, 10)
Even in cases that strLine length was less than the index used to split the string, the program kept running.Now i am trying to do the same in VB.net, but since the strLine is not always bigger than the index used to break the string, it ives an error.I do not want to use try catch, because i will have very dirty and uselless code.
I was thinking something like resume next, but i guess it doesnt exist anymore.
When I have a property within a class such as:
''' <summary>
''' Customer IP address.
''' </summary>
[code].....
I have a page in which one chooses from a selection of dynamically generated buttons. The ASPX code is as follows:
<div>
<asp:Repeater ID="rptrHalls" runat="server" OnItemCommand="Choose_Hall">
<ItemTemplate>
<asp:Button ID="btnChooseHall" runat="server"
[code]....
When I first tried running the code I received an error message of "Invalid postback/callback argument". I set the ASPX page to have a enableEventValidation="false" property and tried running it again. It generates the page fine but when I click on a dynamically generated button it acts as if it is loading something and then just brings me back to select_hall.aspx (the page all this code is one), when (as you can see above) it should take me to select_room.aspx.