|
If you're writing both the software and the add-in's, Remoting is the best way to go!
If I'm sounding like I'm guessing what your trying to do, it's because I am. You haven't povided any detail about what your ultimate goal with this code is, besides transferring a pointer through a Window message. Why are you doing this? How does this little piece fit into the "grand scheme" of things?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i'm not using remoting coz i've a little time to accomplish this task. well, actully i dont know remoting.
Now about my "Grand Scheme", using this if any-how i can pass the object of the office-application to another application-sw, the work is done. One more thing, I have succesfully sent the structure to the "other end", but whenever Object comes in the picture an error occurs:-
An unhandled exception of type 'System.ExecutionEngineException' occurred in
mscorlib.dll
Now thats the problem. Well I'll do try with remoting but it'll take some time, which i dont have now.
-thanks buddy
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
I don't have a lot of time right now, so I can't put a project together to test what your doing. All I can suggest at this time is you might want to take a look at this: The Quick and Dirty Guide to .NET Remoting[^]
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ok thnks for your help .. I'll contact you as soon as i finish this off.
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Hi all,
i am trying to make a client and server application (using sockets) that allow client to upload image files from client machine to server machine.
i am using file stream and network stream to do that.
but the new file always coruppted .
here is my code:-
on client side:- it is a console application, in main function:-
Const portNo = 500
Const FILE_NAME = "c:\image1.tif"
Dim tcpClient As New System.Net.Sockets.TcpClient
tcpClient.Connect("Localhost", portNo)
Dim NWStream As NetworkStream = tcpClient.GetStream
Dim numBytesRead As Integer
Dim bytesToSend(1024) As Byte
Dim fs As FileStream
fs = New FileStream(FILE_NAME, FileMode.Open, _
FileAccess.Read)
Do While fs.ReadByte <= fs.Length
numBytesRead = fs.Read(bytesToSend, i, bytesToSend.Length)
NWStream.Write(bytesToSend, i, numBytesRead)
Loop
fs.Close()
Console.WriteLine("Sending ...")
Console.ReadLine()
tcpClient.Close()
on the server:- main function
Const portNo As Integer = 500
Dim listener As New TcpListener(CType(Dns.Resolve("Localhost").AddressList(0), IPAddress), portNo)
listener.Start()
Console.WriteLine("Listening...")
Dim tcpClient As TcpClient = listener.AcceptTcpClient()
Dim NWStream As NetworkStream = tcpClient.GetStream
Dim buffer(1024) As Byte
Const FILE_NAME = "c:\image2.tif"
Dim fs As System.IO.FileStream
fs = New FileStream(FILE_NAME, FileMode.CreateNew, _
FileAccess.Write)
Do Until (NWStream.DataAvailable = False)
NWStream.Read(buffer, 0, buffer.Length)
fs.Write(buffer, 0, buffer.Length)
Loop
fs.close()
tcpClient.Close()
listener.Stop()
Console.ReadLine()
may be code is not correct !!! i am new to socket programming, so please help me .
any comment will be very helpfull
thanks in advanced..
shelal
|
|
|
|
|
There are LOTS of problem with this code. The most obvious is that your compairing a byte read from the file to the length of the file! Why? By doing this, you're more than likely truncating your reading of the file, so that's a source of corruption.
Do While fs.ReadByte <= fs.Length
Now, you've read a byte from the file and didn't do anything with it, then you read more bytes into the buffer, ignoring the byte you already read and dropped(!). There's another source of corruption.
numBytesRead = fs.Read(bytesToSend, i, bytesToSend.Length)
Now, in your server code, you're indidscriminately writing blocks of 1024 bytes to your image file, completely ignoring who many bytes were actually read from the stream! You have to determine how many bytes were read from the stream so you can only write than many bytes to the file! Without that, especially at the end of the file, you'll be writing more than was actually sent to you. Another source of corruption...
Do Until (NWStream.DataAvailable = False)
' How many bytes were read here??
NWStream.Read(buffer, 0, buffer.Length)
' How many are you writing here??
fs.Write(buffer, 0, buffer.Length)
Loop
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How i can devide two number in the same text field and return the result
the operation is 30/20 this is in the textbox1 then i need the result 1.5
Amarni
|
|
|
|
|
you'll have to split the string first using some form of delimiter (an operator perhaps), parse them, perform the calculation and then return the result.
|
|
|
|
|
i know that.. but how could i use this way ??????
and id the user make an error like this 30//10 or 30/10/
so what is the solution for this problem
Amarni
|
|
|
|
|
Try to split the text then call divide function.
Dim num() As String = txtInput.Text.Split(CChar(vbTab))<br />
'//Throw number to function<br />
Divide(num(0), num(1))
Hope this help. ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
hello can anyone helop me by telling how to make a connection class and how to work with stored procedures in vb.net.
Mohinder Singh
|
|
|
|
|
How about following up on the replies in the previous thread[^] instead of asking the same question again?
---
b { font-weight: normal; }
|
|
|
|
|
can u please tell me how to that thing
Mohinder Singh
|
|
|
|
|
Go to your profile and click on "Messages Posted". There you will find the messages you wrote, and you can view the previous thread.
---
b { font-weight: normal; }
|
|
|
|
|
I am trying to connect to a remote server using a tcpclient and then check if the connection was successful before continuing on with the rest of the program.
i am unsure of how to check if the connection was successful.
|
|
|
|
|
You can do two things:
1) Try to catch exceptions. TcpClient.Connect throws a number of exceptions, among which are SocketException and ObjectDisposedException.
2) Get last error.
Best,
Jun
|
|
|
|
|
i was able to connect to an Excel file using oledb in vb6.0 but there are some unresolved issues
1. rs.Recordcount to retrieve the no of rows in the excel worksheet(i.e 8rows) returns more(6636rows) than the data i have in the excel worksheet.
2. I want to read the header i used so that i can use them as fields in my access db table. but ado start reading the real data instead of starting from the header row.
i am using office-xp. With office xp, reference to Microsoft Office Object library does not allow me to use excel application object in my vb. I want to use this object to open the workbook, get the Worksheet name and read from the worksheet.
any help as regards will be appreciated.
thanks
t.aransiola
|
|
|
|
|
hi everyone, plz plz plz i need help on my pb, i have a project to present on 12 of july & i still can find the solution to my pb
i am using a visual basic 6 platform & i am using a flexgrid control ,i want to select each row appart & i want to wait 0.5 sec then select the next row. the pb is that the row keep on selected but i can't see the selected rows after the 10th row unless i click on the msflexgrid scrollbar.
is there is any way to make it move without pressing.
this is my code:
Dim i As Long
For i = 0 To 33
Me.MSFlexGrid1.Row = i
Me.MSFlexGrid1.Col = 0
Me.MSFlexGrid1.SetFocus
Me.MSFlexGrid1.ColSel = Me.MSFlexGrid1.Cols - 1
Call wait(0.5) ' function to wait
Next
End Sub
so the pb is that i can see the 1st 10 rows but the other rows i can't
plz plz i need help on it
waelhawari
|
|
|
|
|
II WORK IN CRYSTAL REPORT AND I TRY TO VIEW MANY COLUMNS IN MY REPORS AND THE NO OF COLUMNS CANN'T BE PUT IN ONE PAGE BECAUSE I DIR TOO MANY COLUMNS HOW I DIVIDE MY COLUMNS INTO 2 OR 3 PAGES
MA_REFAY
|
|
|
|
|
|
Hi
I wonder if I can make a table to an existing database without using the
statement "Create Table".
I want to use the Datatable with DataColumns and DataRows I have made. Is
there a way I can connect to the database in code and add this DataTable? If so,
please tell me
Fia
|
|
|
|
|
I don't believe you can do that. I think you have to create the table with SQL code first.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
As far as I know you can't do it that way. You have to create tables using the proper SQL syntax.
From what I remember when talking to a SQL engineer @ MS even the SQL Enterprise manager just talks SQL to the DB engine when creating and deleting tables.
My Blog[^] FFRF[^]
|
|
|
|
|
That's part of the SQL specification. The engine and system databases are managed by the same language used to manipulate user databases.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
you can add reference to "Microsoft.SqlServer.Smo" and use it's classes to manage (create, alter, drop) any SQLServer objects - tables, procedures, constraints, indexes, foreign keys etc.
Very useful.
|
|
|
|