|
Sorry you did not quite answer my question.. i was trying to ask how to access an 'Access Database' thru a windows form created on VB.NET .
If you can't do big things, then do small things in big ways...
|
|
|
|
|
You did not mention what database you were using in your original post. Access databases are not really different than any other database.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello all -
this might be a basic question but I can't seem to get the answer right. I have a byte array which needs to be converted to specific data types. I am using the BitConverter class for the conventional conversion such as Int16, Int32 etc. Some of the parameters in the array cannot be converted directly to the specific integer types using the BitCOnverter methods. For example -
parameter1 is the first 3 bytes in the array and needs to be Uint32 for decoding purposes. If I use the convert to Uint32 method - it automatically takes the first 4 bytes. Is there a way to convert just those 3 bytes.
same is true for the next parameter which is only 1 byte but again needs to be Uint32.
Thanks a million
|
|
|
|
|
captainmogo wrote: parameter1 is the first 3 bytes in the array and needs to be Uint32 for decoding purposes. If I use the convert to Uint32 method - it automatically takes the first 4 bytes. Is there a way to convert just those 3 bytes.
I'm not sure if the BitConverter has anything for this. But a solution that would work is to create an array of 4 bytes, copy the 3 bytes in (ensure the remaining byte is zero) and convert it. I think the byte that has to be zero is the last one, but you might want to check that - its been a while since I've done anything at that level.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Adding to Colin's reply:
On "little=endian" systems (such as all Intel/Intel-compatibles) the first byte has the
lowest weight (so you want to clear the fourth byte).
On "big-endian" systems (such as PowerPC, VAX, and then some) it is the opposite.
That's for the representation in memory; what you do in a file is up to you (most systems
use their memory convention, making file exchange difficult between LE/BE systems).
On a wire (such as Ethernet) there are fixed conventions; Ethernet is big-endian.
If you want to write code that supports both, I guess there is a methor or property somewhere,
that tells you what endianness your system has; but I would tend to just test it once at
run-time.
BTW there are two completely different approaches to your conversion problems:
1. write the formulas; looks like threeByteInt=(((byte2<<8)|byte1)<<8)|byte0);
2. use a struct with Marshaling attributes and explicit FieldOffset to simulate
real unions (ala C/C++) or commons (ala Fortran).
|
|
|
|
|
I have copied code from another project where the very same thing works perfectly but in this particular case it just moves right past the call. The only difference between the class I used before and the one I use it in now is that the current class implements IDisposable .
Class 1 (Calling class) values
Private WithEvents _ObjectName As Object
Private Sub UpdateStatus(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ObjectName.StatusChanged
'Code to run here
End Sub Class 2 (Called class) values
Public Event StatusChanged As EventHandler
Public Property CurrentStatus() As Integer
Get
Return _Status
End Get
Set(ByVal value As Integer)
_Status = value
RaiseEvent StatusChanged(Me, EventArgs.Empty)
End Set
End Property
Maybe a fresh set of eyes will see something that I dont.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Private WithEvents _ObjectName As Object<br />
<br />
Private Sub UpdateStatus(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ObjectName.StatusChanged
i don't think that the Object class has StatusChanged event
|
|
|
|
|
Thanks but here is where I declare that event handler.
Public Event StatusChanged As EventHandler <br />
<br />
Public Property CurrentStatus() As Integer <br />
Get <br />
Return _Status <br />
End Get <br />
Set(ByVal value As Integer) <br />
_Status = value <br />
RaiseEvent StatusChanged(Me, EventArgs.Empty) <br />
End Set <br />
End Property
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Private WithEvents _ObjectName As Object
So what? You can declare event handlers all you want. Object will still not have an event called StatusChanged .
|
|
|
|
|
You've seen my posts before and should realize that I make my code generic. Object is just generic for the real class, I apologize that I didnt actually make up a name so as not to confuse people since Object is a class.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
CleaKO wrote: You've seen my posts before and should realize that I make my code generic. Object is just generic for the real class
That's not a good idea when asking questions about your code. Copy and Paste the REAL stuff and it makes solving your problems a whole lot easier.
|
|
|
|
|
Hi,
I'm not sure exactly about your needs... try this plz:
Private WithEvents _ObjectName As New Class2
Private Sub UpdateStatus(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ObjectName.StatusChanged
'Code to run here
End Sub
hope this helps
|
|
|
|
|
You're solution was very close, actually you cant set the New value in the same line but what I was doing differently was that in the other code I was declaring my class object within the WithEvents line and in the new one I was declaring the class and then another class for the event. OOPS!
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Hi,
If you don't want to instantiate a new object in the declaration line you could do the following:
'-- somewhere in the code
_ObjectName = New Class2
AddHandler _ObjectName.StatusChanged, AddressOf SubRoutineName
hope this helps
|
|
|
|
|
How to move up and down row in gridview (vb.net)
Ashu
|
|
|
|
|
clear what you want to do... another thing, next time make your subject relevant to what you would ask.
|
|
|
|
|
You reposted the same question and got an answer. Why don't you continue this is your first thread and ask Christian what he meant?
|
|
|
|
|
Dave Kreskowiak wrote: reposted the same question and got an answer.
Another one of those "I didn't like the answer I got, so I'll try again" idiots
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Sadly, the computer world abounds with them...
|
|
|
|
|
Hi,
I'm not sure if there is a simpler way, but if you are talking about few rows you could use DataView and its sort property to solve your issue:
- Create a DataView based on a table that has an order column (int)
- Set the Sort property to the order column
- Add two buttons up/down
- When you select a row and click up or down you can change the value of the order column in the rows.
This could work if you are managing a transactions list in an accounting system or any system that deal with few rows, in addition the order column could be added on the fly and not part of the database.
hope this helps
|
|
|
|
|
I have this error : Configuration system failed to initialize when I try to start a program.
I read on google about this but I didn't find a solution for my problem.
please help.
Thanks
|
|
|
|
|
Hi,
What do you have in your app.config file!? What's the type of application that you are working on?
regards,
|
|
|
|
|
thanks for your help but for the moment I resolved this problem.
|
|
|
|
|
|
Hi am quite new to programing and would like to know if you can creat a stand alone Data base using tables without the use of SQL and without attaching the front end to an Access table.
Is this possible?
If so has any one got an idea of where to look for some code that i could look at please.
Thank you
|
|
|
|