|
You might want to try something like this:
rtb.SelectionStart = 100;
rtb.SelectionLength = 0;
rtb.SelectedText = "text to insert"
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dim stream As FileStream
Dim tmpstr As String
Dim myFileName As String
Dim myFile As System.IO.FileInfo
myFileName = ListBox1.SelectedItem.ToString
tmpstr = path_name & "\" & myFileName
myFile = New System.IO.FileInfo(fileName:=tmpstr)
stream = File.Create(tmpstr)
Dim info As Byte() = New UTF8Encoding(True).GetBytes("hello")
' Add some information to the file.
stream.Write(info, 0, info.Length)
sream.Close()
it's wokin when im going to read "hello".
bt when im goin 2 read the file's content,instead of "hello".
it's nt done...
plzzzz giv me advice wht 2 do?
|
|
|
|
|
Uhhh...This is very confusing. The code you posted doesn't read anything. It writes a string of bytes to a file and that's about it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
What is path_name at 7th sentens?
|
|
|
|
|
hi. i am trying to read data from usb through vb.net but i am not getting any success. please write to me the code for reading data through usb.plz send reply to <ronaktamboli@gmail.com>
ronak
|
|
|
|
|
That's because you don't read anything from USB. It's a bus, not a port. You read data from the devices attached to the USB bus, but how you do that depends entirely on the device itself and what methods it's driver exposes.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I m using vb.net 2005 & crystal report(bundeled version which comes with .net).
& using Dsn of mysql 5.0 driver for connection on my report to access data.
I wnt to add result from procedure to my report.
Procedure is ready & giving result in mysql but
as i go into database Expert of Report in my application, i cant see the procedure there.
Only add commant & tables of my database shown but how to add procedure to my report .
Anyone please help me.
Thanx.
-- modified at 1:48 Tuesday 20th February, 2007
"The Difficult i can do it now...
The Impossible will take a little longer."
|
|
|
|
|
what are you trying to do is not possible i think so but you can try by database manager property
prem kumar singh
|
|
|
|
|
Thanks for help.
But
Cant we take stored proedure's result into crystal report?
Will u tell me please
How should i Try with database manager property.
-Regards Priya.
"The Difficult i can do it now...
The Impossible will take a little longer."
|
|
|
|
|
I've not used Crystal for many years - but I seem to remember that there was an option for executing a "pass-through" query that would allow you to use native SQL-Server syntax (ie. "EXEC MyStoredProc 'ABC' ").
|
|
|
|
|
I am trying to send an email using my program. How Many ways are ther to do it? Which is the best way, currently i have:
Dim m As New MailMessage(FromtextBox.Text, ToTextBox.Text, SubjectTextBox.Text, BodyTextBox.Text)<br />
Dim a As New Attachment(My.Settings.CurrentList)<br />
Dim c As New SmtpClient<br />
m.Attachments.Add(a)<br />
c.Host = ""<br />
c.Send(m)
My main problem however is that i have no host info, is there anyway to access the host information on the machine the program is running on and, if not, is there an alternative, other than manuel user entry?
Posted by The ANZAC
|
|
|
|
|
If you don't have the host info, you need to use MAPI, there are .NET MAPI wrappers on the web.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You make it sound easy, but i'm new to sending mail and have no idea about MAPI. Is there anyway to programatically extract Host Info or should I just add a user customisable setting to my program.
P.S. What Host Info is actually required to send an email, does it include password etc, or just the server.
Posted by The ANZAC
|
|
|
|
|
I've decided to go with having the user enter the server setting. Then its saved and is used automatically until changed.
Posted by The ANZAC
|
|
|
|
|
<code></code>I want datagrid code in which we r able to enter direct.for eg like in excel sheet we enter means we write in tables .same code want able to write directly in datagrid and then save that data
|
|
|
|
|
You must using dataset and binding it with datagrid
|
|
|
|
|
add ItemTemplates instead of normal columns in datagrid
Nana
|
|
|
|
|
Hello all!
I can't beleive I can't get this, but here it goes. I want to reset a integer number that used for a time. So at the top I have
Public mysec As Integer = 15
Then I have this for my timer
Private Sub tmrGame_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrGame.Tick<br />
Threading.Thread.SpinWait(1000)<br />
mysec = mysec - 1<br />
lblcdClock.Text = ":" & mysec<br />
If mysec > 15 Then<br />
mysec = 0<br />
End If<br />
If mysec = -1 Then<br />
tmrGame.Stop()<br />
lblcdClock.Text = ":" & 0<br />
Threading.Thread.Sleep(2000)<br />
lblcdClock.Text = ":" & 15<br />
End If<br />
End Sub
How can I reset "mysec" to 15 so when the time stops, and I start it agin, it start from 15? Using VS 2003.
Thanks!
Rudy
|
|
|
|
|
The method that starts the timer should reset the variable.
rudemusik wrote: If mysec = -1
if mysec < 0 is a safer check to make, just in case.
So, if it goes over 15, it gets reset to 0, and on the next iteration, it will end ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian!
It's actually counting down from 15. I have mysec = -1 so that a 0 will show. After the 0 shows, I set the label to 15. But it doesn't change my intger, so if it starts again, it will start with -1, -2 and so on. How can I change the 0 to a 15 as if if I were reloading the form to kick off the "Public mysec As Integer = 15" line.
Thanks!
Rudy
|
|
|
|
|
'Resetting' the value is as simple as mysec = 15, you should do this just before you start the countdown.
|
|
|
|
|
Thanks Everybody!
I finally got it. I actually had to put "mysec = 15" at the end of the countdown.
Thanks again!
Rudy
|
|
|
|
|
keep all your code inside inner loop and when the loop will end assign mysec=15
enclose this also inside an outer loop
.use 2 while loop this will be better and give terminating condition in outer while loop
ok
prem kumar singh
|
|
|
|
|
Hi Lucky!
What do you ean by inner loop?
Thanks!
Rudy
|
|
|
|
|
Hi all,
I'm working on the following problem with VB2005: An application (which is not under my control) appends a new line of information to a logfile (*.txt) once per second. A filesystemwatcher raises an event any time the filesize has changed. I have to open the file, read the last line of new information and close the file immediately to allow the next line to be written by 'the other' software.
The problems:
1. The log file is big and becomes bigger every second. So I want to avoid reading the complete file and throw everything away except of the last new line. Has anyone got an idea, how to make a slim 'last-line-reader'?
2. It seems, that the file is not closed after reading immediately, which corresponds to what I find in several books. Any chance to close a file again immediately?
Thanks to all, bodobe
|
|
|
|