|
Hi
I've got Webbrowser control inside my VB form. Kind of like making my own browser using IE engine. When I open Word/Excel files, they open inside webbrowser all right. But how can I properly close the host application when I move to next document (like a web page) ? I guess simply moving off to another web page (using the navigate method) does not properly close the host application and the document. That's what I am doing now.
Also, after I deploy my application, in some computers Word's or Excel's toolbar is visible (when word or excel file is opened) and in some computers it is not visible. What could be causing this ?
mecracked
|
|
|
|
|
Hi all!!
Could somebody please tke a look at the the following?
I have been searching an anwser for a de-serialization trouble i am having in my project, however i cannot find a cause as why it should not work..... The project a server listner setup using sockets so i will post both parts of the code
However, the server side file is equal to the listener side received file, I compared both files in Textpad and it says they are byte identical. Also the serialized class is available in both project parts. I tried both soap and binary formatters which both will not work...
ServerSide Code;
<code>
Dim io As MemoryStream = New MemoryStream
'Dim Bf As BinaryFormatter = New BinaryFormatter
Dim Bf As SoapFormatter = New SoapFormatter
SendXML = False
'-- convert file to byte array
Dim Br As New BinaryReader(File.OpenRead(filepath))
Dim bytes() As Byte = Br.ReadBytes(Br.BaseStream.Length)
Br.Close()
'--set filesize of the file buffer
ReDim SdServerSend.File(bytes.Length)
'-- copy array to .file
SdServerSend.File = bytes
'-- serialize class to IO stream
Bf.Serialize(io, SdServerSend)
'-- testpurpose;
Console.WriteLine(System.Text.Encoding.Default.GetString(io.GetBuffer))
'-- writes IO to hdd
Dim BW As New BinaryWriter(File.OpenWrite("C:\PLC\Listener\Received\temptest " & SdServerSend.Type.ToString & " " & EventCounter & ".bin"))
BW.Write(io.GetBuffer, 0, io.Length)
BW.Close()
'-- set io.postion to 0
io.Position = 0
'-- send serialized data to listener
Form1.ClientSocket.Send(io.GetBuffer, io.Length, 0)
</code>
Listener side;
<code>
'-- Receive Message from Current Connection
numbytes = CurSocket.Receive(Buffer, Buffer.Length, 0)
Dim fs As FileStream
Dim filepath As String = "c:\PLC\Listener\Received\Temp " & EventCounter & ".bin"
lstStatus.Items.Insert(lstStatus.Items.Count, "Received Message " & CurRemIp)
lstStatus.SelectedIndex = lstStatus.Items.Count - 1
'-- write this file to HDD location filepath as temp buffer;
Dim BW As New BinaryWriter(File.OpenWrite(filepath))
BW.Write(Buffer, 0, numbytes)
BW.Close()
'-- copy contents of temp.bin into a byte buffer
fs = File.OpenRead(filepath)
Dim SdServerSend As SerialData = New SerialData
Dim bf As SoapFormatter = New SoapFormatter
'Dim Bf As BinaryFormatter = New BinaryFormatter
'-- deserialize memorystream into dsrecv as SerialData
Dim SocketListenerSDRecv As SerialData = CType(Bf.Deserialize(fs), SerialData)
'-- close filestream
fs.Close()
</code>
So the file i receive is temporarily stored on hdd and reread as a bytearray to de-serialize it into memory,
The deserializer turns up with the following error for soap formater:
ParserError. No assembly is attached to the soap formatter a1:http://schemas.microsoft.com/clr/nsassem/C1000Client/C1000Client%2C%20Version%3D1.0.1899.16105%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull
SerialData;
binary formatter errorcould not find assembly version=1.0.1896.29558, culture=neutral, publickeytoken=null
The files in question both on server and listener are identical
either in SOAP;
<code><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<a1:SerialData id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/C1000Client/C1000Client%2C%20Version%3D1.0.1899.16105%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">
<PLCname id="ref-3">System001</PLCname>
<Type>EVENT</Type>
<File href="#ref-4"/>
</a1:SerialData>
<SOAP-ENC:Array id="ref-4" xsi:type="SOAP-ENC:base64">77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS1YTUxFVkVOVC54bWwgY3JlYXRlZCBhdCAxNC0zLTIwMDUgMTA6MTY6MTIgb24gUExDIGV2ZW50LS0+DQo8SFdGWE1MVjEgeG1sbnM9Imh0dHA6Ly90ZW1wdXJpLm9yZy9IV0ZYTUxWMS54c2QiPg0KICA8VkVSU0lPTj4wMTwvVkVSU0lPTj4NCiAgPEFNU05FVElEPjE5Mi4xNjguMjU1LjIwNC4xLjE8L0FNU05FVElEPg0KICA8QklOPg0KICAgIDxJRD5UZXN0MTwvSUQ+DQogICAgPFZBTFVFPkZhbHNlPC9WQUxVRT4NCiAgICA8Q0FVU0U+RVZFTlQ8L0NBVVNFPg0KICAgIDxRVUFMSUZZPlZBTElEPC9RVUFMSUZZPg0KICAgIDxUWVBFPk1JTjwvVFlQRT4NCiAgICA8U1RBTVA+MTQtMy0yMDA1IDEwOjE1OjU4PC9TVEFNUD4NCiAgPC9CSU4+DQo8L0hXRlhNTFYxPg==</SOAP-ENC:Array>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope></code>
or in Binaryformatter;
<code>
" ÿÿÿÿ" ' IC1000Client, Version=1.0.1899.16105, Culture=neutral, PublicKeyToken=null" C1000Client.SerialData PLCnameTypeFile"C1000Client.Type' '' System001üÿÿÿC1000Client.Type" value__ ' " ¤" '<?xml version="1.0" encoding="utf-8"?>
<!--XMLEVENT.xml created at 14-3-2005 10:18:38 on PLC event-->
<HWFXMLV1 xmlns="http://tempuri.org/HWFXMLV1.xsd">
<VERSION>01</VERSION>
<AMSNETID>192.168.255.204.1.1</AMSNETID>
<BIN>
<ID>Test0</ID>
<VALUE>True</VALUE>
<CAUSE>EVENT</CAUSE>
<QUALIFY>VALID</QUALIFY>
<TYPE>MAX</TYPE>
<STAMP>14-3-2005 10:18:23</STAMP>
</BIN>
</HWFXMLV1>
</code>
If you make something idiotproof, someone else will make a better idiot.....
|
|
|
|
|
Hello guys,
Now I am trying to develope a software using GIS technology. I am using the SpatialWare to store spatial data in database (MS SQL Server 2000). But SpatialWare is not free, so I want to ask if you can tell me some software have same ablilties as SpatialWare and it's freeware. Could you tell me.
Thanks with best regards,
nobita3x
|
|
|
|
|
Have a look at the spatial extension of PostGreSql. I think its named PostGIS or something similar. Dont forget to look at the license. If I remember right it was rather restrictive.
|
|
|
|
|
Thanks Robert. But PostGIS is used for PostgreSQL database, not for MS SQL Server 2000. I hope U can tell me another that is used for MS SQL Server 2000.
Thank U very much.
nobita3x
|
|
|
|
|
I didnt get that you were fixed to Ms SqlServer
I havent yet heart about anything giving free spatial functionality to SqlServer (and I work in a company which creates GIS software). If you need something without costs you will probably have to move to something which is closer to the opensource community.
|
|
|
|
|
Hi,
I have searched in Internet, but result is nothing.
I am using the VB.Net to develope this software.
Could you ask my question.
Thanks,
nobita3x
|
|
|
|
|
This code is not displaying the contents of my text file.. Am I missing something?
Dim TestFile As StreamReader
Dim LineofText As String
TestFile = File.OpenText("C:\dvdpath.txt")
Do Until TestFile.Peek = -1
LineofText = TestFile.ReadLine()
Console.WriteLine(TestFile)
Loop
TestFile.Close()
I'm actually trying to read a file that is over 800k in size and am just trying to learn how to open and read simple text files first. I've already added the System.IO namespace and it compiles fine.. When I execute it an empty window shows and it should show at least 4 lines of text.
Thanx in advance for any assistance!
-mark-
|
|
|
|
|
Try this:
Dim TestFile As StreamReader
Dim LineofText As String
TestFile = File.OpenText("C:\x.txt")
Do Until TestFile.Peek = -1
LineofText = TestFile.ReadLine()
Console.WriteLine(LineofText)
Loop
TestFile.Close()
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
Thanx!! Was a basic mistake I guess
-Mark-
|
|
|
|
|
I have a program that accepts an Arrival Date and a Departure Date. I need to calculate the number of "Years if any, Months if any, Weeks if any and Days if any" between the arrival and departure date. Datediff does not work for me. Any Idea's
Regards
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
What do you mean that datediff doesn't work?
If you want something like "1 year, 2 months, 3 weeks and 5 days" then you have to implement the function yourself.
E.g.: you can use DateDiff to find out how many years is the difference between Arrival and Departure, display year, then use DateAdd to change one of the dates (e.g. add the years to Arrival Departure date) and use DateDiff to find out how many months the difference is now, display months, then use DateAdd to add months to Arrival date, display weeks difference, and so on...
Hope it helps
|
|
|
|
|
can you elaborate?
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
What I meant was, if you need to get the date difference between arrival and departure dates in terms of X years, Y months, Z weeks, and Q days then you need to write your own function.
Your function should first calculate the year difference between the arrival and departure date.
Then you need to either:
- add the years to departure date; or
- deduct the years from arrival date.
After this, you can calculate the remaining month difference between the arrival and departure date by using the modified date and so on.
Example
Departure date = 01/01/2005
Arrival date = 03/02/2006 05/03/2006
Year difference = DateDiff('y', '01/01/2005', '05/03/2006') = 1
Modified departure date = DateAdd('y', 1, '01/01/2005') = 01/01/2006
Arrival date = 03/02/2006
Months difference = DateDiff('m', '01/01/2006', '05/03/2006') = 2
...
and so on till you get the difference in days.
Got it?
Edbert
|
|
|
|
|
Edbert, How did you get the date of 05/03/2006 for a departure date...
Regards
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
Whoops.. sorry . The example arrival date was 03/02/2006 but I changed it to 05/03/2006 because I feel it's a better date example (has 1 year and 2 months difference to the departure date).
I've modified the post. You can check the modified one now.
I hope that explains it,
Edbert
|
|
|
|
|
Thanks, Thought you might like a copy of the finised product...
Dim days As Date
Dim weeks As Date
Dim months As Date
Dim years As Date
Dim numofyears As Integer
Dim numofmonths As Integer
Dim numofdays As Integer
Dim numofweeks As Integer
Dim y As Long = DateDiff(DateInterval.Year, Convert.ToDateTime(dtArrival.Text), Convert.ToDateTime(dtDeparture.Text))
years = DateAdd(DateInterval.Year, y, Convert.ToDateTime(dtArrival.Text))
numofyears = DatePart(DateInterval.Year, years) - DatePart(DateInterval.Year, Convert.ToDateTime(dtArrival.Text))
lblYears.Text = numofyears.ToString
Dim m As Long = DateDiff(DateInterval.Month, Convert.ToDateTime(dtArrival.Text), Convert.ToDateTime(dtDeparture.Text))
months = DateAdd(DateInterval.Month, m, Convert.ToDateTime(dtArrival.Text))
numofmonths = DatePart(DateInterval.Month, months) - DatePart(DateInterval.Month, Convert.ToDateTime(dtArrival.Text))
lblMonths.Text = numofmonths.ToString
Dim d As Long = DateDiff(DateInterval.Day, Convert.ToDateTime(dtArrival.Text), Convert.ToDateTime(dtDeparture.Text))
days = DateAdd(DateInterval.Day, d, Convert.ToDateTime(dtArrival.Text))
numofdays = DatePart(DateInterval.Day, days) - DatePart(DateInterval.Day, Convert.ToDateTime(dtArrival.Text))
lblDays.Text = numofdays
Regards
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
Well....it's not exactly what I had in mind.
But if that works for you then it's fine (does it work? Somehow I feel the logic isn't quite right).
My code (untested):
Dim years As Integer
Dim months as Integer
Dim days as Integer
Dim arrivalDate As Date
Dim departureDate As Date
<code>'Use variables instead of doing Convert repeatedly</code>
arrivalDate = Convert.ToDateTime(dtArrival.Text)
departureDate = Convert.ToDateTime(dtDeparture.Text)
years = DateDiff(DateInterval.Year, arrivalDate, departureDate))
lblYears.Text = years.ToString
<code>'This adds years to departure so we can get only the difference in months</code>
departureDate = DateAdd(DateInterval.Year, years, departureDate)
months = DateDiff(DateInterval.Month, arrivalDate, departureDate)
lblMonths.Text = months.ToString
<code>'This adds months to departure so we can get only the difference in days</code>
departureDate = DateAdd(DateInterval.Month, months, departureDate)
days = DateDiff(DateInterval.Day, arrivalDate, departureDate)
lblDays.Text = days
...
|
|
|
|
|
Thanks for the tips........;)
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
Hi
i have a problem with the crystal reports, in vb.net. i m not using c# as scripting language. i m using vbscript.
at the time of passing the parameter from the form(textboxes), to the crystal reprt. i m not able to do so.
And one intermediate Dialogue box is getting popped up, on which i dont have an control.
Give some preicse information about this information about it, as i have to
DEADLINE to complete this task..
Thanks
Samani Umang N.
22#Golden Jubilee
Mithpur-361345
|
|
|
|
|
|
I am new to the Visual Studio .NET world but would like to control some small ovens with this software. I am planning on using devices from Measurement Computing for my interface out to the world. Also plan on using Softwire for some of the programming. I would like to use as much code that has been already been developed. I am very interested in finding where I can get an already programmed item for PID control. Does anybody know where I can get this code?? Also where is a good place for finding free code for industrial controls???
Thanks for any help!!
|
|
|
|
|
I have created a VB webform to manage my router and wireless clients. I don't now how to submit a username and password to the login page of the router and clients (Linksys and senao web browser config). I must always do this manually. How might I code a username and password routine? Any help is appreciated. Go easy on me, I am a pre-beginner.
Thanks
Ryan
|
|
|
|
|
i want to ask u all that what is better to have more then one object of connection in a application or only one object for every transaction.
and next is what is better to close connection with database at the closing of application or when work completes with db, means i want to ask that should i open and close connection many times or better to open once and close it at the end of appli
|
|
|
|
|