|
I want to write a windows service application that reads a web page. That web page requires that the client can process javascript.
Has anyone successfully implemented Javascript with System.Net.WebClient?
I tried the code from the article "A simple .NET based WebClient with JavaScript support" but that code crashes with an inner JScriptException. Its acknowledged by the author and it looks like the trail ends there.
According to microsoft the Microsoft.JScript.Vsa.VsaEngine used in that project is deprecated.
What is the current working solution for processing webpages in code?
This is what my code looks like. The web page at the URL I am calling uses javascript to set a cookie in order to prove that Javascript is running. It doesn't look like this code can do it. I can set cookies in advance but I can't seem to duplicate the javascipt setting a cookie. Help!
Dim webClient As Net.WebClient = New System.Net.WebClient
webClient.Credentials = System.Net.CredentialCache.DefaultCredentials
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
webClient.Headers.Add(Net.HttpRequestHeader.Cookie, "aCookie:aCokievalue")
Try
Dim data As Stream = webClient.OpenRead(sURL)
Dim reader As New StreamReader(data)
Dim s As String = reader.ReadToEnd()
'response = webClient.DownloadData(sURL)
'Return Encoding.ASCII.GetString(response)
Return s
Catch ex As Exception
Return ""
End Try
|
|
|
|
|
how do you put data into a database from a form?
|
|
|
|
|
1. Connect to database.
2. Create query from the data in the form.
3. Run the query against the database.
4. Disconnect from database.
|
|
|
|
|
how do you create the query ?
|
|
|
|
|
If you don't know SQL, you're going to find this pretty hard to do. Even if you don't want to learn SQL, learn it You ARE going to need it sometime in the future.
The query string is specific to your database table. It usually follow the following format:
SELECT columnName, columnName, columnName FROM tableName
WHERE someCondition
|
|
|
|
|
I have mistakenly deleted the my service exe from the specified path and it can't be obtained again but my control panel is still showing the service icon in my control panel > services. When i try to install the same service again from the installer,it says service already installed. Now how do i remove such a service from my control panel without my service exe?
@!$(-)@ $@r£r@Z
|
|
|
|
|
Uhhh, what does this have to do with VB.NET???
|
|
|
|
|
Hello.
I 'm writing my question for the third time, because I don't get a suitable answer. There is the origin of the Coordinate System on the top left corner of forms in VB.Net project. Is there a method or a code that we use it to change the condition of the origin of the Coordinate System. For example, set the origin of the Coordinate System on centere of the form? can you help me? please send me the method.
Thank you.
Reza Rajabi.
|
|
|
|
|
You could manually transform the co-ordinates. You'd just need to write a method that would add or remove the appropriate number of pixels. When setting the coordinates on a control or window you'd use the method to convert from yours to the windows standard.
As for the code, why not write it yourself? It's not that hard, just some simple maths (addition and subtraction).
|
|
|
|
|
Posting the question a 3rd time won't change the answers. You can change the origin by using the Scale and Transform methods and properties of the Graphics object your using to do the drawing.
|
|
|
|
|
Hello. Thank you for your reply. I used the "scale" method, but I could not change the place of the origin of Coordinate System. I used this code: "Me.Scale()"
Can you help me?
|
|
|
|
|
Did you look at the TranslationTransform of the Graphics object you're using to do the drawing?
|
|
|
|
|
Do not keep reposting the same question. It's considered rude. As stated earlier, please read the forum guidelines. Also, asking for someone to just send you the code is rude. If you have a section of code and are having troubles, please feel free to post that, and the problem, and we'll look at it.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Reza12 wrote: I 'm writing my question for the third time
Didn't you look at the replies you've received? Asking the same question over and over tends to just piss people off around here
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
I am beginning a project working with a paradox file type .DB. This is new to me and I need help. The project is to read the file, update, and add the file data to a database. Has anyone ever worked with paradox files using vb.net? If so please help.
jds1207
|
|
|
|
|
There are a couple of ways you can go about this. You can read the files using a DBase connection type, or you can import the Paradox files into MS Access/SQL Server (depending on the size) and use that as your data source.
I guess it depends whether you need to keep the Paradox file at the end, or if you are simply performing a data migration into a different database.
D.
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
How do you open the file with this type of extension?
|
|
|
|
|
What do you want to do with it once it's open? This is an important point, because if you want to open and use it (as the data source for your project) the answer will be different to if you want to open it, get the information out and migrate it elsewhere...
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
I have a Listview that is populated with information from a database using a datareader. What I'm looking to do is allow the user to select a particular row in the list and output one of the subitems to a simple text file. I'm not sure how to pull or format the subitem though and what properties to use. Any help would be appreciated!! Here is the code I used to populate the listview.
Do While hl7reader.Read
tmp1 = hl7reader("FROM_WHOM")
tmp2 = hl7reader("FROM_TERM")
tmp3 = hl7reader("CRE_TIMESTAMP")
tmp4 = hl7reader("PATIENT_NO")
tmp5 = hl7reader("APPC_DATA")
Dim str(5) As String
Dim itm As ListViewItem
str(0) = tmp1
str(1) = tmp2
str(2) = tmp3
str(3) = tmp4
str(4) = tmp5
itm = New ListViewItem(str)
ListView1.Items.Add(itm)
Loop
|
|
|
|
|
Alright I've got one of the selections outputting correctly. If I select one item, it writes correctly. Now what I'm looking to do is output multiple selections (say 6 items selected). Here's what I have.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ListViewSelect As ListView.SelectedListViewItemCollection = Me.ListView1.SelectedItems
Dim item As ListViewItem
Dim selecteditem As String
'Dim price As Double = 0.0
For Each item In ListViewSelect
selecteditem = item.SubItems(4).Text
Dim writer As StreamWriter = _
New StreamWriter("c:\Test.txt")
Dim line As Stream
writer.WriteLine(selecteditem)
writer.Close()
Next
End Sub
|
|
|
|
|
Hi, I need some help with my structure, I always get this error:
Exception System.NullReferenceException was thrown in debuggee:
Object reference not set to an instance of an object.
And this is the structure and how I'm using it.
Public Class Form1<br />
......<br />
Public Structure ECU_St<br />
Public ID_HS As Integer<br />
Public CB As String<br />
Public C0 As String<br />
Public C1 As String<br />
Public C2 As String<br />
Public C3 As String<br />
Public C4 As String<br />
Public C5 As String<br />
Public C6 As String<br />
Public C7 As String<br />
Public C8 As String<br />
Public C9 As String<br />
Public CA As String<br />
Public PN41 As String<br />
End Structure<br />
.........<br />
Sub ToolStripButton7Click(ByVal sender As Object, ByVal e As EventArgs)<br />
Dim PN As String<br />
Dim HSECU() As ECU_St<br />
Dim i As Integer<br />
................<br />
i = 0<br />
HSECU(i).CB = PN<br />
i = i + 1
I don't know what else to try, always I get the same error, anyone can help me? Thank you!!!
|
|
|
|
|
BThunder wrote: Dim HSECU() As ECU_St
You created an array of empty pointers to ECU_St objects. You never created an instance of these objects though. Also, you didn't provide a size for the array, so you have to increase the number of elements in the array using ReDim Preserve. But, if you're going to go through that hassle, just use a List(Of T) collection instead (only works in VB.NET 2005 and above!):
Dim HSECU As New List(Of ECU_St)
Dim i As Integer = 0
HSECU.Add(New ECU_St)
HSECU(i).CB = PN
i = i + 1
|
|
|
|
|
Thx for your really quick response!!!!
Let me try this
|
|
|
|
|
I already try this, but, when I compile, I get an error:
Expression is a value and therefore cannot be the target of an assignment. (BC30068)
HSECU.Add(New ECU_St)<br />
---> HSECU(i).CB = PN <br />
<br />
HSECU(i).CB = PN assigment???
Any Ideas?
PD. CB and PN are Strings, CB Declared with public
|
|
|
|
|
Assuming code isn't correct...
Dim newNode As ECU_St
newNode.CB = PN
HSECU.Add(newNode)
|
|
|
|