|
I was able to do it by using .rtf property
Now i am facing another issue...
When i get the .rtf text from the rich text box, it is of really big size and the increase in size depends on formatting and things like use of table and other objects.
Not i am not able to find how big the field should be in the db to accommodate text of size 500 char...
I wrote 50 formatted char and it gave 483 char as output. I added a table (no data inside) and it increased to 1093
any idea
Regards
Nishkarsh
|
|
|
|
|
If you don't know how big the text will be, use the MAX version of datatypes. As per documentation, VARCHAR(MAX) can hold 2^31-1 bytes.
|
|
|
|
|
Is the .rtf property the most efficient way to serialize/deserialize the contents of a RichTextBox? Deserializing seems to take time n^3.
|
|
|
|
|
I have searched Google and the message boards but I can't find an answer to this.
strFileName = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\" & Me.dgvData.SelectedRows(0).Cells(0).Value.ToString & ".kml"
Dim sw As StreamWriter = New StreamWriter(strFileName)
sw.WriteLine(strXML)
sw.Close()
strFileName = Chr(34) & strFileName & Chr(34)
procID = Shell(strFileName, AppWinStyle.NormalFocus)
As soon as it hits Shell if stops with file not found, yet the file exists as it has just been created.
As you can see I tried enclosing the file name with "", but that has not helped either.
I am assuming that since a kml file extension is registered to Google Earth that I don't need to specify GE. The file runs just fine if I find it in My Documents and double click it.
Anyone out there who can help?
|
|
|
|
|
Thanks Folks. Question answered in the "How do I..." about the screen saver.
Process.start works just fine.
|
|
|
|
|
hello friends.
i know little knowledge of vb.plz help me if u can.
i want to rotate a text line of about 5oo characters on a single label or any other object which can be changed in the output.
the project is like we read news on the bottom of a news channel which marquees from left to right or right to left.
thanx 4 giving ur precious time but plz help
|
|
|
|
|
|
thanx for d reply it helped me to understand.
please xplain where to find this superMarquee control in vb. which version conain this.
and please tell me how i can change the element text at runtime.
thanks 4 ur concern
|
|
|
|
|
dahras wrote: please xplain where to find this superMarquee control in vb. which version conain this
No Visual Studio version contains that. It's written by the person who wrote the artice. You can download it from the article page and using Visual Studio you can compile it (assuming you cave C# installed) and you have a dll which yo can refer n your project.
dahras wrote: please tell me how i can change the element text at runtime
I'm not familiar with the control so I'm not able to help yo uin that, but you could open the aricle, go to the bottom where you see messages section. Add a new message to contact the author of the article and ask dim for advice. You could also ask if he has VB version of the control
|
|
|
|
|
thanks sir
this tool is mainly 4 c# can u give me idea about how to implement this control in vb.
or is there any other way ???
thanx
|
|
|
|
|
dahras wrote: this tool is mainly 4 c# can u give me idea about how to implement this control in vb.
The tool is only written in C#. That doesn't mean that it can only be used in C#. You can write a DLL in any .Net language (for example in C#) and use it in another language (for example in VB.NET).
As I said, you should ask the author of the article if he has written a VB version (or if someone else has). However, that's not mandatory since you can also use the C# version. It would only be more comfortable for you if you're more familiat with VB
|
|
|
|
|
Hello ! I need to create application that will monitor printer and save backup of every document that is printed on that printer ... It's enough to be in plain text. Printer is connected to a computer and is shared via LAN. Computer is running Windows XP.
Is it possible ? Could you give me some advice, what to use, where and what to read
|
|
|
|
|
|
Thanks, I'll look into it
|
|
|
|
|
From your question, it looks like you want to monitor all printjobs that go to the network-printer. Printers have their own methods of caching pages that need to be printed, and it depends on the driver of the printer that the vendor supplied.
Lastly, a warning; you should check with a lawyer before peeking into other people's documents. Let me add that I'd sue your ass off, if I found out that you're reading my print-outs
If you're just spending too much money on ink on that printer, then try and find a network-admin who can setup some cover-sheets and permissions.
Hope this helps,
I are troll
|
|
|
|
|
hehe thanks for advice But that's now the case, because that printer is in the school and students shouldn't print anything on it, but we allow them ... And because of that they don't have any grantee that this document won't be seen by somebody else ... Printing on that printer is just like posting your document online so that everyone can see it ...
|
|
|
|
|
Good to hear they have a printing service nearby
I are troll
|
|
|
|
|
Hello all,
I am creating a timer in a background worker thread as shown below and want to pass arguements to the event handler 'timerevent'.
Private Sub DoJob(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
Dim timer1 As New System.Timers.Timer
AddHandler timer1.Elapsed, AddressOf timerevent
timer1.start()
End Sub
but in the timer event handler i can only get something called 'signal time' from the elapsedeventargs.
Is there a way to pass arguments for (in my case a string) to the timer event handler.
Also is the elapsed event similar to the tick event?
|
|
|
|
|
Sohaib_A wrote: Is there a way to pass arguments for (in my case a string) to the timer event handler
You can't change the signature of the Elapsed event. Also where would that string come from?
Timer.Elapsed is raised by timer when the interval has elapsed. So you cannot change the code how Elapsed is raised by the timer.
You can store strings for example in class variables and use them, but without knowing anything more of your scenario, it's hard to say if that would be a feasible solution.
Sohaib_A wrote: Also is the elapsed event similar to the tick event?
Yes, Elapsed is for System.Timers.Timer class and Tick is for System.Windows.Forms.Timer class.
|
|
|
|
|
Ok.
Well the strings are stored in a database.Each background worker will take a different string depending on input from user.
This is how i am doing it.
If reading <= m_WorkerList.Count - 1 Then
str = ds1.Tables(0).Rows(0)("ReaderLocation").ToString
status = api.TcpConnectReader(ds1.Tables(0).Rows(0)("ReaderIP").ToString, _
ds1.Tables(0).Rows(0)("ReaderPort"))
If status = 0 Then
api.TcpCloseConnect()
st = str
m_WorkerList(reading).RunWorkerAsync(str)
reading = reading +1
End If
m_Workerlist is a list of BGW that i have initailized earlier.
|
|
|
|
|
Okay, so you pass a string to the worker when you run it. And the worker uses that string when doing it's stuff. How the timer is related to this? Do you have a timer inside the worker, which then causes some actions? If that's the case, could you simply store the string inside individual workers as a class variable and use that class variable whenever Elapsed event is raised?
|
|
|
|
|
Yes there is a timer inside the worker which is started in the worker's dojob event as shown in the code i posted earlier.
Ok..so is a class variable something like a global variable?And after i pass the string to worker's DOJOB event,i should declare at is a class variable in the DOJOB?
Do you have any examples for this?
All the workers will be running in parallel,so will there be multiple instances of this string each with it own value relative to the back ground worker it was passed from?
|
|
|
|
|
You can inherit the BGW and add the variable into that class. I don't have VB at the moment but the basic idea is simple. I believe that this C# snippet will give you the idea. Instead of : in class definition, you would use inherits also the definition of the variable, constructor and property are a bit different, but not much:
public class MyWorker : System.ComponentModel.BackgroundWorker {
private string _customData;
public MyWorker() : base() { }
public string CustomData {
get {
return this._customData;
}
set {
this._customData = value;
}
}
}
When using it, you would:
...
MyWorker theWorker = new MyWorker();
theWorker.CustomData = "ABCD";
theWorker.RunWorkerAsync();
...
This is one way that you define and set the class variable inside each BGW. Now in the DoWork yuo can get the value using CustomData property getter.
|
|
|
|
|
Hi, I am new to this site and so far it has been very helpful, however, I have a problem.
Here is what I have so far:
If File.Exists("C:\\File.txt") Then
Dim sReader As New StreamReader("C:\\File.txt")
Dim CurrentLine As String
Dim DataLines As New System.Collections.Specialized.StringCollection
Do While sReader.EndOfStream = False
CurrentLine = sReader.ReadLine
If CurrentLine.Contains(txtR1.Text) = False Then
DataLines.Add(CurrentLine)
End If
Loop
sReader.Close()
sReader = Nothing
Dim sWriter As New StreamWriter("C:\\File.txt")
For Each CurrentLine In DataLines
sWriter.WriteLine(CurrentLine)
Next
sWriter.Close()
sWriter = Nothing
end if
As you can see txtR1.text is what contains the string that needs to be deleted from the .txt file. It works and will delete the string from the text file (if it is there). However I want to delete from txtR2.text and txtR3.text as well. Unsure if this is possible, is there a way to combine txtR1, txtR2, txtR3?
Using Vb.net(05)
Thanks!
-Rp
|
|
|
|
|
Welcome to CodeProject
To you question, I think there are number of ways doing this but can't you simply use multiple conditions in your if statement, like:
...
If CurrentLine.Contains(txtR1.Text) = False
Or CurrentLine.Contains(txtR2.Text) = False
Or CurrentLine.Contains(txtR3.Text) = False Then
...
|
|
|
|