Click here to Skip to main content
16,007,885 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Custom Controls and client areas. Pin
Luc Pattyn11-Nov-07 15:55
sitebuilderLuc Pattyn11-Nov-07 15:55 
Questionnetwork ip scanner code Pin
salohcin11-Nov-07 15:03
salohcin11-Nov-07 15:03 
AnswerRe: network ip scanner code Pin
Paul Conrad28-Nov-07 15:12
professionalPaul Conrad28-Nov-07 15:12 
QuestionEvent Synchronization Pin
xbiplav11-Nov-07 10:09
xbiplav11-Nov-07 10:09 
Answercross-post, gets ignored Pin
Luc Pattyn11-Nov-07 10:39
sitebuilderLuc Pattyn11-Nov-07 10:39 
JokeRe: cross-post, gets ignored Pin
Paul Conrad11-Nov-07 14:25
professionalPaul Conrad11-Nov-07 14:25 
AnswerRe: Event Synchronization Pin
nlarson1111-Nov-07 10:47
nlarson1111-Nov-07 10:47 
QuestionVB6 Property set with two parameters won't port to VB.Net Pin
nofrontiers11-Nov-07 9:49
nofrontiers11-Nov-07 9:49 
VB6 Property set with two parameters won't port to VB.Net

I'm trying to port a VB6 class called VBXML to VB.Net in such a way to also minimise changes to client code using the class.

In VB6 the class has a property called FieldValue that is defined with 2 parameters:

Public Property Get FieldValue(strXPath As String) As Variant<br />
<br />
    CurrentField = strXPath<br />
    FieldValue = CurrentFieldValue<br />
<br />
End Property<br />
<br />
Public Property Let FieldValue(strXPath As String, pvarNewValue As Variant)<br />
<br />
    CurrentField = strXPath<br />
    CurrentFieldValue = pvarNewValue<br />
<br />
End Property


Now without going into the innards this Property Let allows client code to be written like this:

Dim obj As VBXML<br />
<br />
Set obj = New VBXML<br />
obj.FieldValue("ID") = 10<br />
obj.FieldValue("Name") = "Gordon Brown"<br />
obj.FieldValue("Address") = "10 Downing Street"


This client code in VB6 generates a call to the property let with the string argument strXPath being passed as "ID" or "Name" or "Address" in the 3 examples above and with the variant pvarNewValue being passed as 10 or "Gordon Brown" or "10 Downing Street".

This is very convenient and intuitive syntax a bit like we used record sets:

rs.Fields("ID") = 10<br />
rs.Fields("Name") = "Gordon Brown"<br />
rs.Fields("Address") = "10 Downing Street"


It seams that equivalent VB.Net Property Let declarations are only ever allowed to have 1 parameter otherwise you receive an error: 'Set' method cannot have more than one parameter

So the question is how do I rewrite the class property so that client code will be able to be of this form and with minimal changes? The client code is also being ported to VB.Net by the way.
AnswerRe: VB6 Property set with two parameters won't port to VB.Net Pin
nlarson1111-Nov-07 10:56
nlarson1111-Nov-07 10:56 
GeneralRe: VB6 Property set with two parameters won't port to VB.Net Pin
nofrontiers11-Nov-07 11:26
nofrontiers11-Nov-07 11:26 
QuestionArray, Iteration Pin
roger689711-Nov-07 8:19
roger689711-Nov-07 8:19 
AnswerRe: Array, Iteration Pin
Luc Pattyn11-Nov-07 9:18
sitebuilderLuc Pattyn11-Nov-07 9:18 
Questiondatagrid data to access database Pin
mariap11-Nov-07 2:27
mariap11-Nov-07 2:27 
AnswerRe: datagrid data to access database Pin
pmarfleet11-Nov-07 3:14
pmarfleet11-Nov-07 3:14 
GeneralRe: datagrid data to access database Pin
mariap14-Nov-07 23:36
mariap14-Nov-07 23:36 
GeneralRe: datagrid data to access database Pin
pmarfleet15-Nov-07 0:13
pmarfleet15-Nov-07 0:13 
GeneralRe: datagrid data to access database Pin
pmarfleet15-Nov-07 11:30
pmarfleet15-Nov-07 11:30 
GeneralRe: datagrid data to access database Pin
pmarfleet19-Nov-07 0:07
pmarfleet19-Nov-07 0:07 
GeneralRe: datagrid data to access database Pin
mariap19-Nov-07 8:38
mariap19-Nov-07 8:38 
GeneralRe: datagrid data to access database Pin
pmarfleet19-Nov-07 9:01
pmarfleet19-Nov-07 9:01 
GeneralRe: datagrid data to access database Pin
mariap19-Nov-07 9:57
mariap19-Nov-07 9:57 
GeneralRe: datagrid data to access database Pin
pmarfleet19-Nov-07 10:02
pmarfleet19-Nov-07 10:02 
QuestionPaint a rectangle [modified] Pin
The ANZAC11-Nov-07 0:30
The ANZAC11-Nov-07 0:30 
AnswerRe: Paint a rectangle Pin
Guffa11-Nov-07 0:59
Guffa11-Nov-07 0:59 
GeneralRe: Paint a rectangle Pin
The ANZAC11-Nov-07 1:01
The ANZAC11-Nov-07 1:01 

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.