|
This is because IDList.ToArray() is returning an Array object and not an Object() . You might want to remove the GetType(Int32) and try it. But I think it's still going to fail. The problem your running into is an ArrayList is a general type collection, not an Object(). It can hold any type of data without being cast to a specific type first. You can create an ArrayList without any parameters and just start adding Strings to it and it won't complain. Same is true for Integers...if you just create the ArrayList and start adding numbers to it, chances are that ArrayList is a collection of Integers and not Int32s. This is were your casting problem is coming from. Your trying to do two cast's, an Integer to an Int32, and an Array to an Object(), under the Strict rules.
You either have to use the ArrayList as is, or use an Object() array instead of an ArrayList (consistancy of object types is key!), or get rid of the Option Strict.
Personally, I never use Option Strict...
RageInTheMachine9532
|
|
|
|
|
Can anyone please tell me how to capture the packet in vb.net(code)in windows and how to program to manipulate the data field of the TCP and UDP packets. i have no idea about it. just tell me from the begining. should i have to do the SDK or device driver programming. so where to start.i really need help these days so i am looking forward to you people for some tips.
|
|
|
|
|
I'm trying to understand what you are trying to do.
1. Capture a packet.
2. Modify the data in that TCP or UDP packet.
3. Send the modified packet on its way.
Is this correct?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
yeah correct i want to do the same thing actually i want to make my encryption algorithm and apply on the data field of the UDP and TCP packets in wireless packets. can you tell me or guide me stepwise what should i do . main thing is that i want to do it in vb.net. lookiing forward to you.
|
|
|
|
|
The obvious question is why don't you encrypt the packets at source rather than in transit? (by "in transit" I mean that after the process that is sending the packets has created the packet but before the packet has left the PC) I am assuming that you did not create the process that is sending or receiving the data.
I think what you need to look at is something like an NDIS hook - which is effectively a kernel mode device driver that hooks into the network layer just as the packets are entering/leaving the PC. There is a solution out there that will allow you to create such a hook and pass it into something that isn't a kernel mode process (like VB.NET). However, I don't recall what it is called off the top of my head. (I'll get back to you on that). If you don't want to use that solution then I think you are going to have to create your own kernel mode device driver which most definitely cannot be written in VB.NET.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
What your thinking of is an NDIS Intermediate Driver. These things slide in between the miniport and protocol drivers.
For original poster:
Docs on NDIS Intermediate drivers start here[^]. Your best best is to write the NDIS driver in C++. That'll save you time of recoding all of the structures, constants and function headers. You'll be doing this for about 3 dozen functions and structures. On top of that, you'll have a VERY difficult time debugging this thing unless your up to speed on debugging kernel mode drivers...
RageInTheMachine9532
|
|
|
|
|
Dave Kreskowiak wrote:
What your thinking of is an NDIS Intermediate Driver
Almost, what I was thinking of was an NDIS Filter Hook Driver[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
i cant understand you what are you saying, you mean that
i should NDIS hook , take its output to manipulate data field of TCP and then again pass this information to the driver? where should i write the code in vb.net which will do the work? is this or else?
can you briefly explain the steps involving in this thing?
and can you refer me some tutorials?
anyways thanks i seached on the google and found some sites on ndis.
waiting...
|
|
|
|
|
babur khan wrote:
you mean that
i should NDIS hook , take its output to manipulate data field of TCP and then again pass this information to the driver?
If you are not generating the packets in the first place then yes - The wording of your previous posts indicates that this is the case. If you are generating the packets there are easier solutions open to you.
babur khan wrote:
where should i write the code in vb.net which will do the work?
It is not something that VB.NET can do by itself, you will need a third party piece of software. NTKernel[^] produce a product called WinPKFilter[^] which might suit your needs.
To connect it to VB.NET you will need to P/Invoke the functions that you are interested in.
babur khan wrote:
and can you refer me some tutorials?
The web site, has a forum for its products and demo software to show how to build applications using its components.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
babur khan wrote:
i have no idea about it. just tell me from the begining.
In the beginning, there were dinosaurs! Then they all died...;P
Packet capturing is not so simple that someone could explain everything about it here. It's just too big a topic. But there is a couple of articles on it here[^] and here[^] on CodeProject. There are also some packet capture libraries out there like this one[^]. It amazing what you can find with a Google search on "source code packet capture"!
RageInTheMachine9532
|
|
|
|
|
Dave Kreskowiak wrote:
In the beginning, there were dinosaurs! Then they all died
Airplane? (or Airplane II?)
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
I think it was Airplane!
RageInTheMachine9532
|
|
|
|
|
Hi. I'm a newbie programmer so my problem probably have an easy solution.
Here's the code that adds items to my ComboBox:
*****************************************************'
Sub loadTypCombo()
Dim recset As New ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = loadDatabase(CommonDialog1.FileName)
recset.CursorType = adOpenDynamic
recset.LockType = adLockOptimistic
Set recset.ActiveConnection = conn
recset.Open "SELECT * FROM tblObjects ORDER BY Name"
While Not recset.EOF
TypCombo.AddItem (recset("name"))
recset.MoveNext
Wend
recset.Close
Set recset = Nothing
conn.Close
Set conn = Nothing
End Sub
******************************************************
The problem I have is when I run the program only 4 of the 5 records in tblObjects are added to my ComboBox, however, when I debug all 5 are added and it works like it's supposed to.
How can I fix this?
Thanks in advance, Rikard
|
|
|
|
|
i have a form allows me to add, edit, delete records, and also see the master list of my records, this form has a dataset and a winsock-like object (private withevents) this application is connected to a server using my winsock-like object
what it does is that everytime i click on add or edit, a new form is instantiated and the record which i want to edit from the previous form is loaded in this new form (in the case of add, no data is loaded on the form) after adding or making the changes, the new form calls the add record method / edit record method to...
1. update the changes to the database
2. pass the new data to the server using my winsock-like object
after executing, the new form closes itself. i don't have any problems with updating changes to the database, but when i try to send the new data thru my winsock-like object, it gives me a "object reference not set..." error where in fact i clearly created a new instance of my winsock class when the form was loaded and the connection is still alive between my application and the server, should i change the modifier of my winsock-like object from private to shared or protected? please tell me what went wrong, thanks
|
|
|
|
|
It's definately not a modifier problem. You'll have to supply some code and the exact error message and the line it shows up on. It could also be that the problem is in your "winsock-like" object. Is your object throwing the exception and your main code catching and not handling it?
RageInTheMachine9532
|
|
|
|
|
thanks anyway, it's already working, i realized that i instantiated the winsock object during "form load" and not inside the form's constructor
|
|
|
|
|
How do you pull data from a database and set them as columnheader in listview or a datagrid?
|
|
|
|
|
Are you using a stored procedure?
Give more info about your requirements...
Later
|
|
|
|
|
Student_Name Teacher_Namer Subject Time Date
James Keith Prof. Clark Math 9:00am 01/05/2004
James Keith Prof. Moore English 10:00am 01/05/2004
James Keith Prof. Smith Art 11:00am 01/05/2004
James Keith Prof. James P.E 1:00pm 01/05/2004
James Keith Prof. Brooke Chem 2:00pm 01/05/2004
James Keith Prof. Daniels Math 3:00pm 01/05/2004
Peter Robertson Prof. Clark Math 8:00am 01/05/2004
Peter Robertson Prof. Moore English 12:00am 01/05/2004
Peter Robertson Prof. Smith Art 4:00pm 01/05/2004
Peter Robertson Prof. James P.E 5:00pm 01/05/2004
Peter Robertson Prof. Brooke Chem 6:00pm 01/05/2004
Peter Robertson Prof. Daniels Math 7:00pm 01/05/2004
Teachers + Prof. Clark + Prof. Brooke + Prof. Daniels
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Time
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8:00 + Peter Robertson + +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9:00 + James Keith + +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2:00 + + James Keith
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The list view will be controlled by a date or calendar control. Haven’t decided whether to use a stored procedure. Since I use a select statement with a case argument. Still not getting the look I want.
It would be similar to a cross tab table used in ms access.
<table border=1 cellspacing=0 cellpadding=0><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p align=right style='text-align:right'>Teachers</p><br />
</td><br />
<td width=147 valign=top class="Normal"> <br />
<p>Prof. Clark</p><br />
</td><br />
<td width=136 valign=top class="Normal"> <br />
<p>Prof. Brooke </p><br />
</td><br />
<td width=152 valign=top class="Normal"> <br />
<p>Prof. Daniels</p><br />
</td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>Time</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>8:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> <br />
<p>Peter Robertson</p><br />
</td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>9:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> <br />
<p>James Keith </p><br />
</td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>10:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>11:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>12:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>1:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>2:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> <br />
<p>James Keith</p><br />
</td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>3:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>6:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> <br />
<p>Peter Robertson</p><br />
</td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> </td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
</table>
|
|
|
|
|
Hey Ole123
Well I will leave the front end to you, but if you choose to go with a stored proc then here is the basic layout including getting the headers...
CREATE PROCEDURE MP_CB_Get_CallBacks
AS
-- V1.0.0 : Super Winsock : 4 March 2002
-- Returns the Column names and width for the grid.
-- It also returns the data.
SET NOCOUNT ON
--Returns the Column names and it's width.
-- 1st is the column name & 2nd is the column width and so on.
SELECT
'Id',
0,
'Student_Name',
0,
'Teacher_Name',
2000,
'Subject',
1500,
'Time',
1500,
'Date',
1500
SELECT
[Id],
Student_Name,
Teacher_Name,
Subject,
Time,
Date
FROM
?Table
SET NOCOUNT OFF
GO
/* Hope this helps?
|
|
|
|
|
I forgot to add that the student data is a seperate table as well as the teacher's data. So I have a Student and Teacher table. I don't think I could use a stored procedure.
|
|
|
|
|
Well thats no problem?? Just use a JOIN statement to join the teacher and Student tables... This can be done in a sproc.
If you really get stuck, just post the Student and Teacher Tables structures and what you want to get out of them in your record set, and I will gladly help you write the sproc.
Later
Cliff
|
|
|
|
|
Student_ID | Student_Lname | Student Fname | Subject ID |
----------------------------------------------------------------------
125 | Mason | Steven | 2 |
100 | Jude | Bob | 2 |
199 | Mason | Mark | 2 |
125 | Mason | Steven | 4 |
225 | Stevenson | John | 2 |
125 | Mason | Steven | 5 |
400 | Madison | Ira | 2 |
Teacher_ID | Teacher_Lname | Teacher_Fname | Subject ID | Subject Name| Date | Time|
------------------------------------------------------------------------------------------------------------
1 | Mason | Steven | 2 | Math | 1/1/2004 | 11:00 am
2 | long | Gary | 2 | English|| 1/1/2004 | 1:00 pm
3 | Clark | James | 2 | P.E| 1/1/2004 | 11:00 am
4 | Simmons | Micheal | 4 | Science| 1/1/2004 | 11:00 pm 5 | Bonnila | Richard | 2 |Art | 1/1/2004 | 11:00 am
6 | Law | Katherine | 5 |Social Studies| 1/1/2004 | 9:00 am
7 | Young | David | 2 | Econ| 1/1/2004 | 8:00 am
It should be displayed in the list view as
Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels
___________________________________________
Time
____________________________________________
8:00 | Peter Robertson | Blank|Blank
____________________________________________
9:00 |James Keith | Blank|Blank
____________________________________________
10:00| Blank|Blank| Blank
____________________________________________
11:00| Blank|Blank| Blank
____________________________________________
12:00| Blank|Blank| Blank
____________________________________________
1:00| Blank|Blank| Blank
____________________________________________
2:00 | Blank|Blank| James Keith
____________________________________________
|
|
|
|
|
Still a little stuck so i still need help. I posted a sample tables in the post and what the display should look like...
Thanks for all your help. I have been kicking my self for about two weeks trying to get the display i want with no success.
MSSql does not use the Transform sytnax so i'm not able to create the crosstab look and feel for my listview form in vb.net.
Thanks again for all your help
|
|
|
|
|
Hey Ole
Well your post of the tables is somewhat confusing
Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels
___________________________________________
Time
____________________________________________
8:00 | Peter Robertson | Blank|Blank
____________________________________________
9:00 |James Keith | Blank|Blank
etc...
1.Are your headers always going to be the same? If so then you can just hard code them.
2. Just tell me what the headers are and from there I can get the info from the tables.
3. In a listbox you have to use COURIER NEW as your font, else the spacing is never going to be right.
4. You have to pre-determine your column lengths before you populate the listbox. IE: If you have a column named First_Name, thats 10 characters, and the name is Ole. You will have to add 7 spaces after the name to make the next column's data in line with its header.
Probably a bit confusing the way I explained but just tell me the column headers and I will write the sproc. Thats the easy part.
You will have to do the front end.
Later
Cliff
|
|
|
|