|
No Worries, you can alter the range as necessary and it reports into a datagrid view, but obviously you can report it to other things too.
Sorry about the first code, don't know what happened there. Maybe my brain was running a little slow!
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
how to get VB form data in to a text file in a http server
here is my code but its not working
Dim FStream1 As IO.FileStream
Dim oIE As Object
oIE = CreateObject("internetexplorer.application")
oIE.Navigate("http://116.75.111.202/") = New IO.FileStream("c:\Documents\details", IO.FileMode.Append, IO.FileAccess.Write)
Dim SWriter1 As IO.StreamWriter = New IO.StreamWriter(FStream1)
SWriter1.Write(Text & vbNewLine)
SWriter1.Write(Label1.Text & vbTab)
SWriter1.Write(TextBox1.Text & vbNewLine)
SWriter1.Write(Label2.Text & vbTab)
SWriter1.Write(TextBox2.Text & vbNewLine)
SWriter1.Write(Label3.Text & vbTab)
SWriter1.Write(TextBox3.Text & vbNewLine)
SWriter1.Write(Label4.Text & vbTab)
SWriter1.Write(TextBox4.Text & vbNewLine)
SWriter1.Close()
FStream1.Close()
could anyone help me out with a correct code
|
|
|
|
|
Based on your subject line, I think you need to read the article linked to in my sig. It will solve your problems.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
Dear me. Please tell me that's just a proof of concept. There are so many things wrong with it. You assign a value to a method invocation. You use what appears to be an uninitialised variable. You take input from the user and send it with no verification, leaving you open to injection attacks. And your methodology is pretty much completely wrong. You've even posted a real IP address (which appears to need credentials to be accessed; I hope you provide them)
Your basic idea is to create a text file from your atrociously named controls, and upload it to a server somewhere in the Great Aether. So drop that code snippet and look into the WebClient class
What you need to do is to write a file to a byte array (no need to save it, the UploadData method accepts a byte array and saving just creates a new bottleneck) and call the UploadData method. So create a MemoryStream and StreamWriter. The StreamWriter should be constructed using the MemoryStream. Now, write the data to the StreamWriter in the normal way.
Next, create the WebClient instance, and declare a byte array. The byte array should be equal to the result from the invocation of the MemoryStream's ToArray method. You now have the 'file' as an array of bytes. Then, simply invoke the UploadData of the WebClient instance, passing the web address and the byte array you declared earlier. This will block execution until the upload finishes; if you fancy a challenge, dig into the documentation - there's a method which performs the same operation asynchronously and raises an event when it's done. The return value of the UploadData method is simply the response - it's useful for debugging to see where something went wrong
If, as I suspect, your HTTP server needs credentials, then set the Credentials property of the WebClient instance you declared accordingly
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
harieshkumar.n wrote: oIE.Navigate("http://116.75.111.202/") = New IO.FileStream("c:\Documents\details", IO.FileMode.Append, IO.FileAccess.Write)
What on earth is this??
Considering the FileStream class will not work with the HTTP protocol, you're concept won't work at all. Also, your web directory is probably going to be read only to every client, if this code is running on the client side, it wont be able to write to a file on the web server. Unless you do something very stupid and relax that security restriction.
Is this code in an ASP page?? Is it in some component running on the server?? What kind of app is it??
Remember, the quality of the answer you get is directly dictated by the quality of the question.
And don't use "urgent" anywhere in your post. It only makes people want to ignore you and you're not going to get an answer any faster.
|
|
|
|
|
Dear All,
I have some problem in loading an image in crystal report. I am using VS 2005 with CR 9.
I have a table adapter in which i used an unbound column "Image" of type System.Byte.
And I used the following code to set image.
....
Dim s As String = dt.Rows(0).Item("ImagePath").ToString
Dim fs As FileStream = New FileStream(s, FileMode.Open, FileAccess.Read)
Dim image(fs.Length) As Byte
fs.Read(image, 0, Convert.ToInt32(fs.Length))
dt.Rows(0).Item("Image") = image ................................(1)
fs.Close()
....
But it throws an exception at (1) [Unable to cast type of System.IConvertible to type System.Byte]
I used to debug the code, and when i reached at (1), i found the datatype of dt.Rows(0).item("Image") = System.DBNull
Although it is set to type System.Byte at design time in Table Adapter.
Please help me out
Regards,
Ovais
|
|
|
|
|
I haven't used a Table Adapter like you are talking about, but one thought that came to me when reading this is that a System.Byte is not the same data type as your image variable. You need a Byte array. This code: Dim image(fs.Length) As Byte declares a Byte array, not a Byte.
Hope this helps.
|
|
|
|
|
I am adding values to a Access table (with around 25 values). A date conversion error occurs and I do not know in which line it occurs. It is practically very tedious to go line by line. How do I track this. Someone please help. Thank you in advance.
|
|
|
|
|
If your running thing under the debugger, it'll stop on the exact line the problem occurs.
Also, if you're using string concatenation to "build" the SQL statement, it's very easy to get an error like your describing:
sql = "SELECT something FROM table WHERE field1 = #" & datevalue & "#"
Use parameterized queries instead to have the code automatically convert the date to the appropriate format for the database engine.
|
|
|
|
|
Thank you Dave. I was using parameterized query and it was driving me mad. As you have instructed
i used straight query like this
sql = "SELECT something FROM table WHERE field1 = #" & datevalue & "#"
and solved the problem within no time.
Thanks also to Rajdeep and Christian for your replies.

|
|
|
|
|
Uhhh...no. I said DO NOT do that. Use the parameterized query instead.
|
|
|
|
|
Ideally this should not happen. Are you not doing any sort of validations?
|
|
|
|
|
If you don't want to step through the debugger, do something like this:
Dim sb as StringBuilder = new StringBuilder()
// first line of insert
sb.AppendLine("Inserted one")
// second insert
sb.AppendLine("Inserted two")
etc
Put this in a try/catch and put a breakpoint in the catch. Then, you can look at your string builder to see which line blew up. Then you can focus on that one line ( and repeat, I would not be surprised if you fix one line and then find another has the same issue, if the code does the same thing, you're likely to have repeated your bug more than once.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
I am using VB 2005 and have connected to an Access database.
Rather than do the usual for i = 0 to total, can you populate an array with the dataset some how.
|
|
|
|
|
Do you want an array filled with the tables the DataSet contains? If so, and if you have included the System.Linq namespace, then you can use ds.Tables.ToArray() , where ds is your DataSet. The result of that method call will be the Tables property as an array
|
|
|
|
|
Or if you want to enter the values of a certain column from the dataset into the array you can use the For Each loop:
For Each rw As DataRow In YourDataSet.Table("WhatEverTable").Rows
Or considering that a dataset, in a sense, is a sophisticated array, you could consider forgetting about copying values to an array first, and just get them straight from the dataset.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hello!
I'm new to vb.net,anyone of u please help.I need a syntax of how to save and retrieve an image in vb.net2008 and Access as backend.I've used 8 textfields,1 combobox and 1 picture box and 2 buttons of save and retrieve.But I dont know how to write a code to save and retrieve an image in vb.net2008.
Help me, pleassse
Mirza 
|
|
|
|
|
|
You can't possibly be the first one to ever want to do this. So, a little Google goes a long way, and I see that it's been documented about 40,000 times. Here, allow me... Click This[^].
|
|
|
|
|
I want ti know how to detect face from human picture using VB 6.0.but i don't know how to do it.please tell me and send VB 6.0 source code that program.please sent reply soon.
My mail address is "sumudu1986@gmail.com"
|
|
|
|
|
Good luck with that.
First, you need to get VB.Net, as there is no support for VB6.
Second, No-one, and I really mean NO-ONE is going to do the code for you.
If you do not know how to even go about it, buy a beginners book and read it, slowly, twice, then when there is glimmering of understanding, attempt it yourself. When you fail, and you will, ask specific code questions about the portions of code you are failing on.
Thirdly, Never give your email address out, or you will suffer.
This constitutes a friendly reply, some here would really burn you for that.
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
"Some here"?? Noone here is going to burn him for it, but the spammer idiots out in the world will surely handle that themselves.
|
|
|
|
|
VB6 doesn't have any image handling capability that would work with the speed required to detect a face. You'd have to use an external C++ library to give you more speed.
Also, the fact that you're even asking this question says that you don't have the skill required to implement a face dectection algorithm yourself. This will be quite a large research project for you. Since you don't have the skill to do the research yourself, you don't have the skill required to implement the algorithm.
But, I'll give you a hint. Start Googling for "face detection algorithm". You'll notice that most of the URL's you get in the search results are for universities. What does that tell you about the technology?
|
|
|
|
|
I knew the task would be too much for him, it is a Massive Ask.
Certainly not something to be tried by anyone under the level of "Expert"
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
@Dalek and Dave
i want to ,sir, is this thing possible under vb 2008
vb2008 seems much more advanced than the previous versions
and one more thing
the one who started this thread is a girl(well, the name is of a girl)
cheers.
TheMrProgrammer
|
|
|
|