|
You already posted it here[^].
We can't tell you why this error came up because we don't have the data that this code is working against. I've told you how to debug this yourself because you're the only one who's going to be able to do it.
And I've already told you about the pile of resource leaks you have in this code.
|
|
|
|
|
|
I'm having a small issue wrapping my head around why this isn't working.
I have a file in my project called CollectionClasses.vb - within the Solution Explorer it's located in ProjectBase\Utilities\CollectionClasses.vb. Within that file, I've got classes that do not have Namespaces attached to them , they look like this.
Public Class LinerTypesCollection
Inherits System.Collections.ObjectModel.ObservableCollection(Of String)
Public Sub New(ByVal IsMetric As Boolean)
End Sub
End Class
Now, I've got a file within my project called StartPanel.vb, it is located ProjectBase\UI\Fitting Panels\Start\StartPanel.vb that has a Partial Class that uses the class defined above
Namespace Base.Controls.Panels
Partial Public Class StartPanel
Public Sub New (ByVal bool as Boolean, Optional ByVal bool2 as Boolean = false)
cmbBox.ItemsSource = New LinerTypesCollection(False)
End Sub
End Class
End Namespace
I am also trying to utilize this LinerTypesCollection class in another part of my software within a Public Class, like so, but unfortunately, I'm stuck in a rut, possibly over something simple, as to trying to figure out why. While trying to use LinerTypesCollection within my second class, it just won't show up. This class is located in the following location ProjectBase\UI\Primatives\ConnectionOptions.vb
Namespace Base.Utilities
Public Class ConnectionOption
Public Sub New (ByVal IsMetric as Boolean)
cmbBox.ItemsSource = New LinerTypesCollection(False)
End Sub
End Class
End Namespace
I have tried to change the "Base.Utilities" to "Base.Controls.Panels" to match and no avail, any ideas?
Thanks!
|
|
|
|
|
In VB.NET, classes with no namespace reside in the default namespace for the project.
Since your project is called ProjectBase, that's probably what the default namespace is set to. But you'll need to check the project properties to be sure.
How to: Change the Namespace for an Application (Visual Basic)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard,
Thanks for replying!
That was my one of my initial assumptions as well, however; I have tried to do the following with my second class..
Namespace Base.Utilities
Public Class ConnectionOption
Public Sub New (ByVal IsMetric as Boolean)
cmbBox.ItemsSource = New ProjectBase.LinerTypesCollection(False)
End Sub
End Class
End Namespace
I have confirmed that the Root Namespace of the Project matches the what I'm trying to use, but alas, no avail. Intellisense won't pick it up as visible and I can't build it.
|
|
|
|
|
Try looking at your project in the Object Browser[^] to see if you can track down the class.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard,
I feel like a moron, but I knew it was something simple. Looking in the Object Browser as you recommended, it became clear that the files I was looking at were NOT in the same project.
They bled together pretty well in the Solution Explorer.
Regardless, thank you for taking the time to reply to my messages!
|
|
|
|
|
How to convert this codes to C# from VB6:
Hide Copy Code
Call rs.Open("SELECT DISTINCT Reci FROM " & CStr(duzina), Conn, adOpenKeyset)
rs.Move getRandom(0, rs.RecordCount - 1)
rec = rs.Fields(0).Value
Set rs = Conn.Execute("SELECT DISTINCT Reci FROM " & CStr(Len(r)))
|
|
|
|
|
|
I am using Access database!!!
|
|
|
|
|
|
|
It's both sad and frightening that this comes up so much on coding forums when people post their SQL code. +1 for fighting the good fight. I see it so much I'm almost numb to it now.
|
|
|
|
|
You would open a connection, then a issue a command against that connection, and then retrieving the results.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to pick random word from database and shuffle it???
|
|
|
|
|
Repeating the question means I'll be repeating my answer.
Try it one step at a time; first write some code to connect and execute a query. Once that works, you can try to get a random value.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I don't know to work with databases.
|
|
|
|
|
..then I suggest you learn very quickly, as it is part of the code you are converting.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Can you give me link for learning database ?
|
|
|
|
|
Google[^] has a list; but skip the ones that use a wizard to generate the code.
As is, the VB code you posted would load an entire table and then pick a random record from that list. It would have been more efficient to generate a random id and fetch a single record.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
How to convert Access Database to SQL Database ?
|
|
|
|
|
There's a button if you open the database in Access in edit-mode , that size "upsize to SQL". It will only convert tables, not forms or reports.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I cannot find that option!!!
|
|
|
|
|
|
I think I am using developer version!
|
|
|
|