|
Hello there,
Sorry for the code in this article, but i need it to lay out my problem, as the code i am refering to is a "complex" struct;
I have this problem with the "complex" struct. The compiler keeps telling me the following message: The object reference is not instanciated on another object. I tried loads of methods to write into the struct but nothing seems to help... can anybody help me out??
Here are the struct definitions:
<code>
<StructLayout(LayoutKind.Sequential, pack:=1)> _
Public Class ST_TeleMeBool
'-- enum unmanagedtype ByValStr = a fixed size string of 80 chars
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public ID As String = ""
<MarshalAs(UnmanagedType.I1)> _
Public Value As Boolean
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public Qualify As String = ""
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public TypeB As String = ""
End Class
</code>
<code>
<StructLayout(LayoutKind.Sequential, pack:=1)> _
Public Class ST_TelemeOut
'-- enum unmanagedtype I2 = a 2 byte signed integer (aka short / system.int16)
<MarshalAs(UnmanagedType.I2)> _
Public CountBool As Integer
'-- enum unmanagedtype ByValArray = an array of which the maximum elementsize MUST be specified (sizeconst)
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1000)> _
Public bArray(1000) As ST_TeleMeBool
End Class
</code>
>>> Basicly, the struct ST_TelemeOut consists of 2 elements: CountBool as int and bArray(1000)of ST_TelemeBool.
As written before, i need to fill the main structure ST_TelemeOut;
<code>
with ST_TelemeOut
.CountBool = 100
end with
</code>
This causes no problems, however, when i access the array of structs, the difficulties begin....
<code>
With ST_TelemeOut
For i = 0 to .countbool
.bArray(i).ID = "My ID" & i
.bArray(i).Value = True
.bArray(i).Qualify = "My Qualifier" & i
next i
end with
</code>
The first codeline within the for loop allready crashes....
can anybody tell me how i need to write values in this struct??
If you make something idiotproof, someone else will make a better idiot.....
|
|
|
|
|
Please, can anybody help me out on the previous mentioned problem??:
symantically there is nothing wrong with;
<br />
StTelemeout.bArray(0).ID = "Test"<br />
But the complier seriously does not like it at all..
what am i doing wrong here??
If you make something idiotproof, someone else will make a better idiot.....
|
|
|
|
|
PROBLEM SOLVED <<<<
This is the correct way to tackle the problem;
<code>for i = 0 to 4 do
with sttelemeOut
sttelemebool.id = "blabla"
.bArray(i) = sttelemeBool
end with
next i </code>
If you make something idiotproof, someone else will make a better idiot.....
|
|
|
|
|
does any one know any usefull link or tutorial or code to develop a simple peer to peer application?
Thanks in Advance
Mahmoud Manasrah
|
|
|
|
|
i just want to know how programing on using com port.....
i want the device to send a data from my device to my vb interface....
my device is using micro controller
okies..thankss
ii
|
|
|
|
|
|
Hi All
I am using microsoft's web browser control in my application.
There is a bug in this component. In the application where i am using this component, the situation is like explained below.
I have a MDI Application with some forms like FORM1, FORM2 etc.
Lets assume that FORM1 has got web browser component, so when i load FORM1, it shows correctly and works normally. But incase i make the visibility of FORM1 to be false and show another form FORM2 and after some time make the FORM2 invisible and FORM1 as visible, web browser control crashes. It looks like a White Painted Window without a border and with no contents in it ( however there were contents in the form when it was made invisible) and also the control is in a dead state ie we cant do anything to it.
Any Solutions?
Sumit Domyan
|
|
|
|
|
Is there any easy way to Export data between tables with one SQL command without using DTS?
I found ExportData , i used but it doesnt work? how will i use it?
DB1.dbo.TheSameTable.ExportData (DB2.dbo.TheSameTable)
Thanks a lot I remember an Easy Way, Select Into Command then alter table for key fields
|
|
|
|
|
I have a web application that allows a use to attach a file and email to recipients. The app works fine while in debug mode, but the following senario does not work: A user at pc01 accesses my web app at resides on pc02, and tries to attach a file that resides on pc03. The file is shared amongst EVERYBODY. I gather that IUSR does not have access to this file, unless I explicitly give it access. I would like to us the page user's credentials and then authorise access to the file. does anybody know how I can go about doing this?
Thanks
|
|
|
|
|
If the file is an attachment posted by the user on PC01, then PC01 would be the authenticated user reading the file and sending it to the web app on PC03. The web server will not log into PC03 and "pick up" the file.
How are you attaching this file? Are you just giving the path to the file to the web app so it know where to find it or are you actually uploading the file to the web server in an HTTP POST?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When I try to Add Reference of Visual Basics Package & Deployment Wizard in VB.net, i get following Error.
A reference to 'Package and Deployment Wizard' could not be added. Converting the type library to a .net assembly failed. Error loading type library/DLL.
Anybody can help me ?
Jatin Mehta
|
|
|
|
|
The Package and Deployment Wizard is an addin for Visual Studio 6, so I'm not surprised that it can't be imported. Why on earth would you want to do such a thing anyway? I can't think of a single reason to do this...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I need to use a popup alert which is similar to MSN messenger in my project. I have seen a CodeProjct article on how to do this with ASP.NET, but it works only within a web browser. I need to know how I could do the same thing in a desktop environment, where the user gets a notification via a Popup Alert, periodically.
I dont mind using a prebuilt component even, as long as it is free. If not I would greatly appreciate if someone could give me some pointers on how to get this thing started. Any development language is fine as long as it's Microsoft technology.
Thanx a lot, in advance
Eraj
|
|
|
|
|
I've never used MSN Messenger, so I have no idea what your trying to accomplish. A more complete description or the requirements would probably help.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey try doing a search here on codeproject.com for notification window or popup control. I have a seen a couple here in the C# controls...
[CDH]
Thanks cPod....
|
|
|
|
|
Hi,
I am programming in VB.NET compact framework . I am trying to create the program so the tabs on the tabcontrol is in color (for example, first tab would be all red, second tab would be yellow, third tab blue, etc...). I tried to use tabControl1.GetTabRect(0) to get the rectangle for the tab, but CF does not support getTabRect. Is there any other way to get the coordinates for the tab rectangle?
Thanks in advance,
John
|
|
|
|
|
Your question would be better handled in the Embedded/Mobile Forum[^]. It actually has nothing to do with VB.NET or any other managed langugage, but is more concerned with ownerdrawing a custom control in the .NET Compact Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am working on a few applications in VB.net which use a custom application context for many things such as showing the splash screen, database login form, and finally launching the main form. I have looked all over for a way to put a unhandled exception handler in the custom Application Context so anything that "spawned" from it so to speak would be covered if a exception occured. Is there a way that this can be done? I have tried a few of the examples on CodeProject but still no luck. Doing something like Throw New Exception("this is a test") without a Try Catch will cause the debugger to popup and not the exception handler.
Thanks in advance...
The network is down...let's go get bagels.
|
|
|
|
|
What do you mean by "custom Application Context"? Are you talking about AppDomains? Exceptions will not cross AppDomain boundries.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using Microsoft Access 97. I am programming the forms using visual basic that comes with Access 97. I am trying to get a certain date in a certain format but can't figure out why it doesn't work. I am updating an excel document.
Dim strDate as Date
strDate = Format(Now, "mmmm d, yyyy")
objSheet.Range("H9").Value = strDate
this produces 2/16/2005
I am trying to out put February 16, 2005
What am I doing wrong?
Thanks in advance!
Beginner in VB
|
|
|
|
|
There is nothing wrong with your VB format code. My guess is that your excel spreadsheet is reformatting the date value. Check the column formatting properties in Excel - the problem is not the VB part.
Robert
|
|
|
|
|
Your right but do you know how I can set the format to the right property in excel using VB?
I will set the value like this:
objSheet.Range("H9").Value = Now()
Then I should be able to use VB to format that excel object.
If I can set the horizontal alignment to right (objSheet.Range("H9").HorizontalAlignment = xlRight) then I should be able to some way set the format property to tell it to show the date as "February 17, 2005". Do you know how?
Thanks in advance!!
Beginner in VB
|
|
|
|
|
I'm fairly new to VB.NET, and am almost embarassed to ask this, but...
If I already have a form instance open and want to refer back to it, how do I do that?
Example
---------
Public F1 as New Form1 '(say it has two textboxes 1 and 2)
F1.show() 'Fill out TextBox1
Dim F2 as New Form2
F2.show()
Now I'm in the F2 instance of Form2. I get some input that I now want to put back into F1. When I try the following in F2
F1.TextBox2.Text="yadayadayada"
I get a syntax problem (squiggly underline) unless I re-instantiate F1 like so...
Dim F1 as New Form1
This, of course, results in a new F1 instance, not the one I had before.
Thanks for any help! If this is in any of my books, I can't seem to find it.
Hal in AZ
|
|
|
|
|
If the form is no longer visible, then even though the class instance exists, the window does not. You need to get F1 to store this string variable outside the textbox ( best place would be in the click event that closes the window ), so you can still get to it. It's the height of ugliness for a control variable to be public, in any case.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Sorry for not being clearer. The instance F1 is still visible, and its control TextBox1 contains data I want to use. I simply go to F2 to collect additional data, and want to put that data back into the same instance (F1) of Form1.
Hal in AZ
|
|
|
|