Click here to Skip to main content
15,920,217 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Visual Basic 2008 Express: Sendkeys Pin
Dave Kreskowiak4-May-09 17:21
mveDave Kreskowiak4-May-09 17:21 
GeneralRe: Visual Basic 2008 Express: Sendkeys Pin
helen004-May-09 18:08
helen004-May-09 18:08 
GeneralRe: Visual Basic 2008 Express: Sendkeys Pin
Christian Graus4-May-09 19:51
protectorChristian Graus4-May-09 19:51 
GeneralRe: Visual Basic 2008 Express: Sendkeys Pin
Dave Kreskowiak5-May-09 3:24
mveDave Kreskowiak5-May-09 3:24 
QuestionConstructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
Alaric_4-May-09 10:30
professionalAlaric_4-May-09 10:30 
AnswerRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
MidwestLimey4-May-09 10:39
professionalMidwestLimey4-May-09 10:39 
GeneralRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
Alaric_4-May-09 11:30
professionalAlaric_4-May-09 11:30 
AnswerRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) [modified] Pin
Alaric_4-May-09 10:52
professionalAlaric_4-May-09 10:52 
Ok...never mind - I should have known:
The call to the constructor has to be like this:
Public Sub New(ByVal type As LocationType, ByVal element As InspectionEntity)
    Me.New(type, New List(Of InspectionEntity)(element))
End Sub
Public Sub New(ByVal type As LocationType, ByVal entities As List(Of InspectionEntity))
    Me.New(type, entities, New InspectionEntity([LIB].Enumerations.TableIDDefault.NullKey, "", ""))
End Sub

Note the parentheses surrounding "element" instead of curly braces...which would be the standard in every language OTHER than VB.

New problem though:
The element being passed in is null, and I get an ArgumentNullException saying that the list cannot be initialized with a null object. Anyone good enough with predicates that they could provide one that could initialize the list with element if !element.Equals(null) and suppress the initialization if the argument is null....I mean..."nothing"?

I'm pretty sure that an IIF will not work in this case, but please feel free to prove me wrong! Smile | :)

Update: I proved myself wrong! A chained IIF works...albeit wastefully since the true and false conditions must be evaluated, but it works
Public Sub Store(ByVal type As Location.LocationType, ByVal element As InspectionEntity)
'...
If Not typeAlreadyTracked Then
   'Theres no actual line-continuation '_' in my code. I only placed it here because the forum posts will not scroll horizontally.
   'The code is actually much more legible in a single line
Me._locations.Add(IIf((element Is Nothing), New Location(type), New Location(type, CType(_
 IIf element Is Nothing, New InspectionEntity(-999, "", ""), element), InspectionEntity))))
   typeAlreadyTracked = True
End If
End Sub

Both ternary conditions in the chain are the same check
I perform an IIF(element is nothing...) and another IIF(element is nothing...) within the transverse of the initial condition
(i.e. IIF(element is nothing) - "True of False" is a tautological impossibility because it requires element to be both null and !null at the same time; which essentially provides a true ternary evaluation (albeit with the computational slowdown of a full-scan evaluation)

"I need build Skynet. Plz send code"

modified on Monday, May 4, 2009 5:40 PM

GeneralRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
Alaric_4-May-09 10:57
professionalAlaric_4-May-09 10:57 
Questionif statement.... Pin
Jamal Abdul Nasir4-May-09 9:55
Jamal Abdul Nasir4-May-09 9:55 
AnswerRe: if statement.... Pin
MidwestLimey4-May-09 10:05
professionalMidwestLimey4-May-09 10:05 
AnswerRe: if statement.... Pin
Dalek Dave4-May-09 10:25
professionalDalek Dave4-May-09 10:25 
GeneralRe: if statement.... Pin
Andy Missico4-May-09 14:57
Andy Missico4-May-09 14:57 
AnswerRe: if statement.... Pin
Tiyani Miyambo4-May-09 22:42
Tiyani Miyambo4-May-09 22:42 
GeneralRe: if statement.... Pin
Christian Graus4-May-09 22:46
protectorChristian Graus4-May-09 22:46 
GeneralRe: if statement.... Pin
Dave Kreskowiak5-May-09 3:20
mveDave Kreskowiak5-May-09 3:20 
Questionsourcecode download Pin
Vb200914-May-09 5:05
Vb200914-May-09 5:05 
AnswerRe: sourcecode download Pin
Tom Deketelaere4-May-09 5:16
professionalTom Deketelaere4-May-09 5:16 
AnswerRe: sourcecode download Pin
Dave Kreskowiak4-May-09 5:16
mveDave Kreskowiak4-May-09 5:16 
AnswerRe: sourcecode download Pin
Christian Graus4-May-09 13:36
protectorChristian Graus4-May-09 13:36 
GeneralRe: sourcecode download Pin
Rajesh Anuhya4-May-09 18:39
professionalRajesh Anuhya4-May-09 18:39 
QuestionHow can I take one record from one form and the values to open another form? Pin
waner michaud4-May-09 3:27
waner michaud4-May-09 3:27 
AnswerRe: How can I take one record from one form and the values to open another form? Pin
Tom Deketelaere4-May-09 3:37
professionalTom Deketelaere4-May-09 3:37 
GeneralRe: How can I take one record from one form and the values to open another form? Pin
waner michaud4-May-09 5:42
waner michaud4-May-09 5:42 
GeneralRe: How can I take one record from one form and the values to open another form? Pin
Andy Missico4-May-09 14:54
Andy Missico4-May-09 14:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.