C# - (.net) Is There Any Intrinsic Difference Between .net Explicit Structs And C++ Unions?

Jul 22, 2009

That is the question. Is there anything you can do with c++ unions that you can't with c# Explicit structs?

View 3 Replies


ADVERTISEMENT

.net - Linq To SQL With Multiple Unions?

Oct 29, 2010

I have a linq union statement that has been giving me some trouble and I can't see where the issue is.The error is....All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.

I know the error means that I am selecting different amounts of elements in one of the linq statements, but I've examined this query extensively and I haven't been able to see that as the issue.

[Code]...

View 1 Replies

What Is An Intrinsic Value Type

Feb 15, 2011

What is an intrinsic value type, and what is the difference to non-intrinsic value types?I couldn't find documentation about the effect of the option "Function returning intrinsic value type without return value." in Visual Studio's VB.Net project properties'

View 2 Replies

Pass Address Of A Structure Which Contains Addresses Of Othere Structures And Unions?

Jul 22, 2009

I am running into a problem which I am using C Dll into my VB.net code. I have .H file which shows implementation of this DLL in C language.This .H file contains many structures and unions that contain variable of some structures type. There is a main structure which contains the pointers to these structures and unions and finally address of main structure is passed into the dll function.

I am enable to figure out how to create structures and unions with marshalling in vb.net and how to pass address of a structure which contains addresses of othere structures and unions.

View 2 Replies

.net - Extending Sealed Intrinsic Datatypes Using CompilerServices.Extensions-No Way To Reuse?

Nov 11, 2010

I defined the following extension of the Date? data type

[Code]...

But when I moved my compiler definition to a separate DLL, I the ToObject method was no longer available from my project even though I had referenced the Class project which now contained the extension. Is this a limitation of the Compiler Extensions? HOw do you get reusability out of them?

View 1 Replies

Array Structs Definition?

Aug 2, 2011

i'm lost on how to do this inline.It's easy to say

Dim X as Integer = new Integer(4) {1,2,3,4}
but i'm lost on:
Structure ThisType

[code]....

View 3 Replies

C++ - Pinvoke Using Structs In Call

May 3, 2011

I'm really struggling with the following pinvoke call. I've tried numerous different ways of doing this but still no joy. The call runs through, but I get a 'Bad parameter' message back with suggests there is something wrong with the struct, since I've ran through a c++ example of this code and the parameters are all correct.

[Code]...

View 1 Replies

C++ Sending Structs Over Sockets

Aug 25, 2009

i am using vb.net and i would to send some structs to a C++ tcp server.The problem is the structs i am sending might contain other structs.[code]Lets say i want to send FirstStruct over to the C++ Server.

View 2 Replies

VB6 To .NET Interop - Types And Structs?

Dec 2, 2009

I'm working on some interpo between VB6 and VB.NET and I've hit (another?) brick wall.I need to pass an array of "stuff" between VB6 and VB.NET. This contains an ADO recordset and 4 string values. There could be any number of these 5 items passed, so they will have to be an array of whatever.Seemed to me that in VB I should create a Type and in .NET a Struct, then it should be easy. However...

On running the VB app it fails to start with an error "Function or interface marked as restricted, or the function uses automation type not supported in Visual Basic"

[Code]...

View 5 Replies

How To Generate XML File From Array Of Structs

Apr 30, 2012

I need assistance generating a xml file by reading values from an array of structs.

my struct looks like this:
public structure myStruct
dim ID as int
dim myArray1 as boolean
dim myArray2 as boolean
dim myArray3 as boolean
dim x as int
dim y as int

I have several instances of these structs. I also have universal variables that are declared outside of the structs. I am looking to generate a xml file like this:

[Code]...

But how would I assign the values of each element by reading them in from the struct? Or do I need to use the XmlSerializer Class instead?

View 1 Replies

Reading A Text File Into An Array Of Structs?

Mar 22, 2009

I have an assignment where I must read the information from a text file into an array of structs, so that when a part number is input, the correct price will be displayed.

the file is a text file named shoeinfo.txt

it looks like this: BZB34,40.99
BZJ25,54.50
JMM97,14.99

[Code].....

unfortunately I am unable to figure out how the code is to be read into the array. i.e. item(0).partnum = BZB34 item(0).price = 4099D

View 4 Replies

Search An Array Of Structs Using A String As An Index?

Apr 1, 2009

I have been searching for a while now, but I still can't seem to figure this out. I wrote a rather large program, and to make things more efficient I started to create structs to store more info in a variable.All was well replacing my old code with new code, till I reached a certain point and found that blindly using a loop of integers to access the indexes of the array wouldn't work anymore... I need to access a specific struct by the information contained in a single variable within the struct (like a hashtable key), but can't seem to figure out how.

Is it possible for me to go through my array indexes in a fashion like this?:
Dim myArray(TableCount) As myStruct
Dim TableName As String = "SomeTable"

[code].....

View 2 Replies

Store References To A Bunch Of Structs In A Collection?

Oct 28, 2011

I would like to store references to a bunch of structs in a collection. The general scaffolding looks like this:

Structure myStructType
Dim prop1 as String
Dim prop2 as int
End Structure

[Code]....

now this doesn't work, because it's referencing the same memory. What I would really want is the 'pass reference by value' behaviour that is also used for reference types, so that I can easily keep producing more of them.

Is there any way to fix this other than to make the structs into classes? Is this actually a proper way to use structs, or do I have it all wrong?

View 1 Replies

Can't Find Intrinsic "Server" Object In A Program

Dec 16, 2009

I have a couple of NET 2.0 projects on the go, but in one of them, I can't access the "Server" object to get at its HtmlEncode property. i.e Server.HtmlEncode("xxx") does not work.

I get the following error displayed in Visual Studio design time error log: "Local variable 'server' cannot be referred to before it is declared."

I have tried to add a manual reference to System.Web, but although the dll file is present, it doesn't add itself on - or at least it doesn't display on the "Add Reference" dialog as being added. BUT here is what's interesting - I can access other intrinsic objects such as "Request", "Response"...etc. All except "Server"!

View 2 Replies

Cannot Find The Intrinsic "Server" Object In A .NET 2.0 Project?

Dec 16, 2009

I have a couple of NET 2.0 projects on the go, but in one of them, I can't access the "Server" object to get at its HtmlEncode property.i.e Server.HtmlEncode("xxx") does not work.

I get the following error displayed in Visual Studio design time error log: "Local variable 'server' cannot be referred to before it is declared." I have tried to add a manual reference to System.Web, but although the dll file is present, it doesn't add itself on - or at least it doesn't display on the "Add Reference" dialog as being added. BUT here is what's interesting - I can access other intrinsic objects such as "Request", "Response"...etc. All except "Server" This is only happening to 1 particular project. In other projects, I can access the "Server" object just fine.

View 1 Replies

64-bit Error With LayoutKind.Explicit?

Apr 7, 2010

I run understanding code in my bridge program to call the double dummy solver dds.dll.

<DllImport("dds.dll", CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function SolveBoard(ByVal deal As dealstruct, ByVal target As Integer, ByVal solutions As Integer, ByVal mode As Integer, ByRef tricks As futureTricks) As Integer End Function <StructLayout(LayoutKind.Explicit)> _ Public Structure dealstruct <FieldOffset(0)> Public trump As Integer <FieldOffset(4)> Public first As Integer

[code].....

After filling in the variables, the double dummy solver is called by:

calldll = SolveBoard(dealStr, target, solutions, mode, futureStr)

With a 32-bits machine this code is functioning correct, but with a 64-bit machine the code generates next error code:

System.TypeLoadException:Could not load type 'Dealstruct' from assembly B-Bridge version 1.1.7, Culture=neutral, PublicKeyToken=null' because an object field at offset 20 that is incorrectly aligned or overlapped by a non-object field.

hich adjustments I have to make to the code so it will function correctly on 64-bit machine.

View 1 Replies

C# - SQL Explicit And Implicit Permissions?

Mar 14, 2012

If default 'sa' account has sys_admin permissions for the whole SQL instance and all its databases. On the database itself, if I don't have db_datareader permission enabled, I would assume it doesn't need it as it is implied but I was wondering in .net, is there way to check if db_datareader has explicitly been enabled and not just implied from the 'sa' being a sys_admin.

View 1 Replies

DLL Explicit Run-time Linking?

Feb 25, 2009

What are the main functions needed to create a .dll file in vb.net which needs to be Explicitly linked i.e at run time to an application Plz post me an equivalent code snippet in VB.Net

Explicit run-time linkingDLL files may be explicitly loaded at run-time, a process referred to simply as run-time dynamic linking by Microsoft, by using the LoadLibrary (or LoadLibraryEx) API function. The GetProcAddress API function is used to lookup exported symbols by name, and FreeLibrary — to unload the DLL.

[Code]...

View 2 Replies

Option Explicit Datarow Value?

Jun 14, 2011

If a field called X in a datarow called R is an int32 and Y is an int32 how can I make this statement work:

r!x += y with option strict on.

Error 8 Option Strict On prohibits operands of type Object for operator '+'.

View 6 Replies

Add An Explicit Reference To System.Drawing?

Sep 13, 2011

How do I add an explicit reference to system.drawing in visual basic 2010 express console application?

View 1 Replies

Explicit Add / Remove For Event In Program?

Jan 10, 2011

In C# you can define explicit add/remove code when an event is subscribed/unsubscribed.

Is this possible in VB.net?

View 2 Replies

Explicit Interface Implementation In Program?

Oct 16, 2009

How to implement explicit interface implementation in VB.NET?

View 3 Replies

If A Property Has No Explicit Return What Is It Returning?

Feb 27, 2012

I have some code I inherited which has a lot of warnings that I would like to get removed. Many are of the form Property '<propertyname>' doesn't return a value on all code paths. I know why it is saying this, I'm just trying to determine what the correct 0 impact way of fixing this is.[code]Unfortuantely if I put this in my code (having changed the local variable name to avoid collisions) it then complains that it is being used before it has been assigned a value.Try to analyze IL in LinqPad (not sure if this is a good test or not) reveals that the empty method is the same as the above that Reflector gave me but it is different from return Nothing and return "".What can I use to get rid of this warning while guaranteeing the code runs 100% the same? [code]I'm not sure what ldloc.0 does here. I'm wondering if it is trying to get something from a register which will be null and if that is therefore the same as ldnull in this situation but I havent' ever really studied IL much before...

View 2 Replies

Custom Implicit/Explicit Conversion In 2003?

Aug 16, 2005

would like to define some custom Implicit conversion function within my VB class. How can i do that. I have seen samples in C# but not in VB

View 8 Replies

Access A Data Repeater's Item By Index Instead Of Explicit Name?

May 21, 2010

Right now I'm using the following code in my markup[cod]e...

I would like to be able to call it by index instead of explicitly by "SpeakerName". Is there a way to do this in ASP.NET 4.0?

View 1 Replies

Use VB `option` Statements (explicit/infer/strict) In T4 Templates?

Jul 22, 2010

When creating a T4 template in VB.NET, how do you specify Option Explicit, Option Strict,and Option Infer settings? There's some sort of <#@ #> tag for doing this, but I can't find it.

View 1 Replies

Cannot Implicitly Convert Type 'decimal' To 'int'. An Explicit Conversion Exists?

Mar 7, 2009

Cannot implicitly convert type 'decimal' to 'int'. An explicit conversion exists

View 1 Replies

Explicit Call To The Data Source .Insert() Method/event?

May 28, 2009

I need to explicitly load my data source variables and then call the insert method associated with the data source. The sample VB .net code is listed below. So is it sufficient for me to just call the Insert() method when I am ready to insert my values? Or do I need to create an insert event? You see if I look at the properties window for the data source, there is a lightning bolt icon that will generate events for the data source such as Insert,Inserting,Disposing,Init,Load etc.

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Me.SqlDataSource1.InsertParameters.Add("@Title", "Mr.")
Me.SqlDataSource1.Insert()

View 1 Replies

Change Byte() To Structs For Readability And Convert Struct To Byte Stream For Socket Send()

Dec 8, 2009

I just converted the following code from c# to vb.net. It is functional and works correctly with my company's firmware/devices. My next challenge. Previous serialport code used much more readable structs which where then converted (after building a packet) into byte() automatically as part of the serialport encoding. (this is my understanding)How could I

1. morph byte arrays 'ToSocket' and 'ToMTP' below into structs and

2. convert into byte array for Socket.BeginSend(byte(),.....) to stream out to remote devices?


Imports System.ComponentModel
Imports System.Text
Imports System.Net.Sockets

[Code]....

View 3 Replies

Cannot Implicitly Convert Type 'decimal' To 'int'. An Explicit Conversion Exists (are You Missing A Cast?)

Jul 12, 2011

I am calling a GetSerialNo function But it showing some error like:

Cannot implicitly convert type 'decimal' to 'int'. An explicit conversion exists (are you missing a cast?).

Here is the code:

CODE:

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved