Pass udt to class

It seems I have run into a new problem now...

I want to feed a class with a UDT.
The UDT is declared publicly in a module.
Is that not possible?
It says something like "Only publicly declare user-defined types can be..."

Does anybody know this message?

0
Anders
9/8/2010 6:11:08 PM
vb.general.discussion 1016 articles. 0 followers. Follow

3 Replies
1548 Views

Similar Articles

[PageSpeed] 59


"Anders Jorgenson" <a.jorg@lycos.com> wrote in message 
news:Oq0cqF4TLHA.4980@TK2MSFTNGP04.phx.gbl...
> It seems I have run into a new problem now...
>
> I want to feed a class with a UDT.
> The UDT is declared publicly in a module.
> Is that not possible?
> It says something like "Only publicly declare user-defined types can 
> be..."
>
> Does anybody know this message?
>

Most everybody that's ever tried to use a public UDT in a class module. UDTs 
and classes are fire and water. They just don't mix well together.  The 
problem you're having is that the UDT is not part of the class's public 
interface.  You need to define the UDT in the class module. Now, the problem 
is that no other part of your project can "see" the UDT without a reference 
to the object created from your class.

Generally, IMO the "best" advice is to convert the UDT to a class itself.

-- 
Mike
 

0
MikeD
9/8/2010 6:29:22 PM
"Anders Jorgenson" <a.jorg@lycos.com> wrote in message 
news:Oq0cqF4TLHA.4980@TK2MSFTNGP04.phx.gbl...
> It seems I have run into a new problem now...
>
> I want to feed a class with a UDT.
> The UDT is declared publicly in a module.
> Is that not possible?
> It says something like "Only publicly declare user-defined types can 
> be..."
>
> Does anybody know this message?

In the method declaration, use Friend instead of Public. 


0
Nobody
9/9/2010 12:50:54 AM

"Nobody" <nobody@nobody.com> wrote in message 
news:i69b2g$rst$1@speranza.aioe.org...
> "Anders Jorgenson" <a.jorg@lycos.com> wrote in message 
> news:Oq0cqF4TLHA.4980@TK2MSFTNGP04.phx.gbl...
>> It seems I have run into a new problem now...
>>
>> I want to feed a class with a UDT.
>> The UDT is declared publicly in a module.
>> Is that not possible?
>> It says something like "Only publicly declare user-defined types can 
>> be..."
>>
>> Does anybody know this message?
>
> In the method declaration, use Friend instead of Public.


But then the method is not callable outside the project since the method 
would no longer be part of the class's public interface.

-- 
Mike
 

0
MikeD
9/9/2010 12:54:53 PM
Reply:

Similar Artilces:

associating a custom class to a resource
Let's say you have your own collection of customized common controls, all derived from the original ones. So, CustomEdit derived from CEdit, CustomButton derived from CButton, etc. Now, let's say you only provide clients with the headers of your classes, a lib file and a DLL containing the implementation. When creating an edit box in the resource editor, how can you associate it with CustomEdit instead of CEdit? The only way I am able to do this right now is to first associate it with CEdit, and then go make the change in the code to CustomEdit. In other words, I can't see the Cu...

Passing Array to DLL from VB
Hi all How to send Array to C++ DLL and Get return array from VB? Please Help me. Thanks. Amrit "Amrit" wrote: > Hi all > > How to send Array to C++ DLL and Get return array from VB? > Please Help me. > Thanks. > Amrit > > > hi, http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q207931 Selvam ...

Sockets newbie
I've just followed a CSocket tutorial off Codeproject which seems straightforward enough; it passes a file from a server to a client. I'm more interesting in passing structured data around; can someone give me some guidelines? Say I want to pass an object like a class. I'm guessing that byte packing and other issues (release / debug versions?) mean that passing a chunk of memory (ie pClass to pClass+sizeof(Class)) to another computer (pCopyOfClass = recieved data buffer) would probably heave over. Thanks On 5 Jul 2005 04:01:30 -0700, "zardoz" <silangdon@hotmail.c...

serialisation of classes to generate XMLDocument
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather than creating a file. I assume I should be using System.IO.MemoryStream but can't get this to work. ' XML will be serialized to file.xml, in UTF-8, with BOM. Dim tw As New System.Xml.XmlTextWriter( _ New System.IO.FileStream("file.xml", System.IO.FileMode.Create), _ New System.Text.UTF8Encoding(True)) ser.Serialize(tw, domainObj...

parameters passed to a macro file.
Hi I have a macro that run from DOS and launching GP, but I need to pass some parameters like ID Company. Can I do this? -- Evelin. Sorry, you cannot pass parameters to a macro file. You might find it works better to use a third party tool like Omni Login to automate logins. David Musgrave [MSFT] Senior Development Consultant Escalation Engineer MBS Support - Asia Pacific Microsoft Business Solutions http://www.microsoft.com/BusinessSolutions mailto:dmusgrav@online.microsoft.com Any views contained within are my personal views and not necessarily Microsoft Business Solutions policy...

Passing number from comboxbox to a button
I want to open a form filtered on the ID number selected in a combobox. Using the button wizard in Access 2007 I don't get the combobox value as an option for linking fields. So how can I pass the ID number into the next form (bound to a table) and have it find an existing record or creating a new one if needed? I know this is basic stuff but I'm stumped. Thanks On Mon, 29 Oct 2007 15:14:01 -0700, TLuebke wrote: > I want to open a form filtered on the ID number selected in a combobox. Using > the button wizard in Access 2007 I don't get the combobox value as an opt...

passing arrays to VB via EXCEL4 API #3
Jim - Nothing personal - thanks for the response. I guess I'll have to kee searching for an Excel archeologist. Say... maybe this knowledge o antiquities is a marketable skill! Hmm... Thanks again, - Ro -- cell divisio ----------------------------------------------------------------------- cell division's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1610 View this thread: http://www.excelforum.com/showthread.php?threadid=27553 ...

runtime error class not registered
When I open Outlook 2003 I get an error message "A Runtime Error has occurred, do you wish to debug? Line 297 Error: Class not Registered." I upgraded from Office 2000. I have Norton @005 on my computer and never received this message before. ...

AfxBeginThread, Thread Pool and Runtime Class
I am trying to change an ISAPI Extension so it uses Thread Pooling. I've downloaded the sample from Microsoft and able to get it running. The problem I am encountering has to do with the AfxBeginThread function and a Runtime Class. I don't know how to let the class know how to pass any parameters through the UI thread. The unconverted ISAPI Extension uses this call: CClientSession* pWinThread = (CClientSession*)AfxBeginThread(RUNTIME_CLASS(CClientSession)); Whereas the sample uses: CWinThread* pWinThread = AfxBeginThread((AFX_THREADPROC)ThreadProc, m_hIoPort); Note the MS Example...

Filter expression passed with DoCmd
It appears that the filter expression passed to a report as a part of the DoCmd expression is not available in the Open code. I.e., Me.Filter is null. When? OnLoad? Oops, wrong group...........sorry "Bill" <billstanton@psln.com> wrote in message news:TO-dnbGyUMhI2y_anZ2dnUVZ_jydnZ2d@trueband.net... > It appears that the filter expression passed to > a report as a part of the DoCmd expression > is not available in the Open code. > > I.e., Me.Filter is null. > > When? OnLoad? > > > "Bill" <billstanton@psln.com> wrote in me...

Moving subclasses to different classes
I'm having trouble figuring out how to move subclasses to different classes (to re-assign budget categories to differnt umbrella budget areas). I see a "MOVE" button at the bottom of the list of Classes but can't figure out how to make it active. Anyone know the secret to moving classes without deleting them, recreating them under a new high level class, and re-assigning the transactions? Thanks in Advance!! Never mind -- you just delete the class and ask it to reassign things to a new subclass bucket. PRODUCT WISHLIST: Have the "MOVE" button active...

calling protected method by another class
Hello, I do not understand one thing. Method CView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); is protected and in spite of that it is called by CDocument. How is that possible? Can you please explain? Vaclav "Vaclav" <vjedlicka@atlas.cz> ha scritto nel messaggio news:uQdS%23MV$HHA.3400@TK2MSFTNGP03.phx.gbl... > Hello, > > I do not understand one thing. > > Method > > CView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint); > > is protected and in spite of that it is called by CDocument. How is that > possible? >...

How much time has passed?
Using Excel 2003 I am using the following formula to calculate how much time has passed since a particular event. =DATEDIF(D2,NOW(),"y") This returns the passage of time in full years. I am stumped trying to get the result in years and months such as "3 years 6 months." Can anyone help? Check out http://support.microsoft.com/kb/290190/en-us , particular event being a birthday. John "BK" <nospam@nospam.com> schreef in bericht news:%231vwgIXRIHA.5208@TK2MSFTNGP04.phx.gbl... > Using Excel 2003 > > I am using the following formula to calc...

Passing variables between a form and macro
Hi I have a working Excel VBA macro and would like to use a form for all the inputs. I have the form and the code behind the text/combo boxes etc. I just don't know how to call the form so that the data collected is passed to the variables in the main macro. I searched for this information but can only find info on creating the form rather than having it run with a macro. I'd appreciate any info, links etc. It would be great if you could point me to an example form with all the suurounding code, declarations etc. Can the form be used for the output of the macro? Thanks David ...

Squeaky clean code: Trapping & passing on WM_SYSCOMMAND
I've written custom code to minimize my app by overriding WindowProc(), trappping WM_SYSCOMMAND, and checking to see if the message is SC_MINIMIZE. Pretty standard stuff, but my question is: What is the absolutely correct way to pass on other (non-SC_MINIMIZE) messages? I'm assuming I don't want to pass on the message I'm looking for after I've processed it myself(?) I need to return something that resolves to a successful LRESULT, but I don't know if that's simply the boolean TRUE or not. Thanks, Rick Lee Here's my code to illustrate: LRESULT CMainFrame::Win...

How to shrink UML Class diagram?
Hi, I just want to print a UML diagram with class names only. How to shrink the Class box to just one row containing only the class name? thanks, -Kay ...

Passed exam 92%, and question
Hi Everyone, I passed my exam for RMS HQ today with a score of 92% And now i wonder, are there here any people from Holland? Because the organization where i passed my exam said they didn't see this exam much in Holland. Greetings, Raymond Bakker The Netherlands. Raymond, In Holland there is Retail Technology Nederland BV based in Assen. Their phone number is +31 (30) 601 3933. The person to speak to is Liesbeth. I'm Dutch too but based in the UK at Retail Technology Limited +44 845 450 4905. Regards, Eugenio "Raymond Bakker" wrote: > Hi Everyone, > >...

Pass argument for a command waiting for user input
Hi All, I am using perforce, in one scenario after execution of the command it keeps waiting for the user input on the command prompt. Once i give it displays some data and exits. I need to pass the argument after execution of the command in my automation script. Please let me know how that can be done. Also i need to capture the data. Thanks in advance. Harsha Check this http://openadda.com ...

passing arrays to VB via EXCEL4 API
I've written what seems like pretty straight-forward code, bu regardless of how much I simplify it, I can't get it to work. I'd lik to build an XLOPER that represents an array ( type xltypeMulti) whic contains some number of XLOPERs representing ints (type xltypeInt). After that, I want to pass it via the xlUDF function to VB code. Here's pretty much the entire block of interesting code which lives i the xll: XLOPER xelem[2]; XLOPER xArray; XLOPER xFuncStr; XLOPER xRet; char funcName[20]; xelem[0].xltype = xelem[1].xltype = xltypeInt; xelem[0].val.w = 1; xelem[1].val.w = 2...

UML Class Diagram in Visio
Hello, I am trying to use Visio to work on a UML Class Diagram for a Squeak project. I am trying to figure out how to hide the visibility icons (+, -, etc) from the predefined Class object. Also, where the methods are, I need to get rid of the () (method call parens) that are automatically appended to the methods. This is because private/public is not really relevant in Squeak, and methods (or messages) don't have parens. Any help is greatly appreciated, -- Jason Whitehurst Unfortunately, there is no way to hide the visibility icons and the () in the Operations section. -- -ronn...

How to make a CEdit class unmodifiable
How do you make a CEdit unmodifiable by the user? I am using a multiline CEdit control for a remote console application and I need to display output on this window. However I do not want the user to be able to type within the output box. If I disable the control, the text gets grayed out and is hard to read,the user cannot select the text to copy, or scroll through its contents. So how do I get the CEdit to just allow the user to select and copy the text, without modifying it in anyway? Nick "Nick Schultz" <nick.schultz@flir.com> wrote in message news:%23EtIIFO7I...

how do i access my outlook express for my online class
Please assist me, I'm taking a college course that uses, FLexnet and I am required to log on to outlook express. Please advise, I need to post home work and check in. Crystal "outlook express to access flex net" <outlook express to access flex net@discussions.microsoft.com> wrote in message news:4271352C-9C4C-4593-A63D-6D2F33026E30@microsoft.com... > Please assist me, I'm taking a college course that uses, FLexnet and I > am > required to log on to outlook express. Please advise, I need to post > home > work and check in. Ask in a newsgroup for...

Serializing a collection class
Hi, is it possible to serialize a top-level class with a collection of items? For example, is this possible: <ParkingLot ...> <ParkedCar><Make>Ford</Make></ParkedCar> <ParkedMotorcycle><Make>Honda</Make></ParkedMotorcycle> <ParkedCar><Make>Hyondai</Make></ParkedCar> <ParkedCar><Make>Volvo</Make></ParkedCar> .... lots of other cars and motorcycles ... </ParkingLot> I know it is possible to serialize a known number of vehicles, with a class like this: public class ParkingLot { ...

creating a light-weight CWnd-derived class
I would like to create a very light-weight, standalone, non-visible, NULL-parented CWnd-derived class, without relying on any resource created in ..rc file (like CDialog which requires a dialog template). This light-weight class is used as a private message and timer handler, with a HWND which can be passed to, in my case, DirectShow API for event notifications; and in general use, I can instantiate such class in anywhere and in any UI-thread with ease. I did consider deriving from CStatic, as the class is simple and small enough. However, it requires a parent CWnd, i.e. it cannot be a...

Passing XML via linked server
When I execute the following stored procedure it should return XML output. EXEC SALES.customer_db.dbo.spILD_homepage_sel '<homepage catid="777"> <billingcustid>777</billingcustid> </homepage>' It works fine on the SALES (local) server. I get something like: XML_F52E2B61-18A1-11d1-B105-00805F49916B <status>Invalid homepage info specified.</status> But when I call it from the BILLING server (where SALES is set up as a linked server), I get hexidecimal output like: XML_F52E2B61-18A1-11d1-B105-00805F49916B 0x44004406730074006100740...