|
MaxLength of textbox in Vb.Net is counted by character.
In English, 1 character = 1 byte. But in many different languages, 1 character = 2 bytes.
So if you set MaxLength of textbox is 10. It means you can enter 10 characters in textbox. It's wrong, because if 1 character = 2 bytes then you have 20 bytes. And you can't insert that value into database.
So how could i check MaxLength of textbox by bytes ( not by character )?
|
|
|
|
|
Actually, in .NET, strings are always unicode. The MaxLength is the number of characters, regardless of space taken. It would be stupid for it to mean anything else.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Greetings all,
I was reading the msdn on a comparison between Windows Installer and ClickOnce and it says that windows installer has an automatic update option, but you have to write something into the application that programmatically checks for updates.
Can anyone point me in a direction that would help out with this? I don't even know where to start looking. I just need a simple updater that checks a text file on the server and downloads & installs the updates. I noticed on this site there is an autoupdating article, but it says it's only for intrAnet... that doesn't help me unfortunately :-/
I was also reading that you can do this with something like... bit shifting or merging or something to update specific files, I lost the link to that and cannot find it again.
Really, I want to eventually get a some of the data into dlls, which I have been playing with, and then only update the dlls when errors are found, but this is a lower priority than just getting the updater to work. So, any help is much appreciated!
Thanks,
Mike
MultiPlayer Online, Turn based strategy games that I am working on can be found at: 1483online.com and Thermopylae-Online.com ;-D, Thanks!
|
|
|
|
|
I am writing a small text editor and I am able to open a word document but unable to save it how can I do this in VB.net.
Below is the code that I have for opening a word doc.
Case "doc"<br />
objWord = CreateObject("Word.Application")<br />
objDoc = objWord.Documents.Open(OFD1.FileName, , True, , , , , , , , , False)<br />
objDoc.Select()<br />
rtbText.Text = objWord.Selection.Text<br />
objDoc.Close()<br />
objWord.Quit()<br />
End Select
|
|
|
|
|
1) I cannot see you making any changes to the Word doc in the code.
2) You have not called the Save method - does the True param in the Open method mean Save on close? If not, you need to call the Save method on objDoc.
Shreekar
|
|
|
|
|
To be honest I've no idea what the True param is for in the Open method as it is code that I downloaded from one of the code sites. I've deleted it all, so that now I just have objDoc = objWord.Documents.Open(OFD1.FileName) It has made no difference to the program.
Here is what I am using to try and save the document,
Case ".DOC"<br />
<br />
objWord = CreateObject("Word.Application")<br />
objTempDoc = objWord.Documents.Add<br />
objWord.Visible = False<br />
<br />
' Position Word off the screen...this keeps Word invisible <br />
' throughout.<br />
objWord.WindowState = 0<br />
objWord.Top = -3000<br />
' Copy the contents of the textbox to the clipboard<br />
Clipboard.SetDataObject(rtbText.Text)<br />
With objTempDoc<br />
.Content.Paste()<br />
.Activate()<br />
.Save()<br />
objWord.visible = False ' This line of code fixes the error<br />
.Close()<br />
End With<br />
objWord.Quit()
If it would help, I could zip it up and upload it to my site so that you can take a proper look at what I'm trying to do.
|
|
|
|
|
Would not you like to give a name and path to the temp doc while/before saving it?
Anybloodyid wrote: objWord.visible = False ' This line of code fixes the error
Which error?
And finally, what is NOT working currently (I am assuming the temp doc is not saved) and what is the error that is thrown?
Shreekar
|
|
|
|
|
objWord.visible = False ' This line of code fixes the error
Oops this should not be there, ignore it, I've now removed it from the code.
If the temp doc is saved in rtf then all is ok, but if I save it as a word doc then it is saved but loses all it's formating
I'm thinking of just saving docs as rtf or plain text I think it's quicker.
Or maybe saving in my own format *.qwt can this be done?
|
|
|
|
|
Hi,
I'm using VB.NET 2005 Express, and I want to create a price break DataGrid having three columns, with an unknown number of rows.
In column 0, I want "From"
In column 1, I want "To"
In column 2, I want "Price"
That bit is easy enough.
The complicated bit, for me, is applying a min and max to the "From" and "To" cells. So, for example, if the user has entered ...
From|To|Price
1|9|5.00
... on the first row, when the user comes to add the next row, I want the "From" cell on the new row to only accept a value greater than 9, so the table may look like ...
From|To|Price
1|9|5.00
10|20|4.50
Any help would be greatly appreciated.
|
|
|
|
|
You can use the DataGridView1_CellValidated method to validate your numbers.
In this method use code such as the following to accomplish the validating:
If Me.DataGridView1.Rows(Me.DataGridView1.CurrentRow.Index).Cells(0).Value < 9 Then
'handle error
End If
-- modified at 11:04 Wednesday 17th January, 2007
|
|
|
|
|
I package my program, installed it and now when i am running it,
I is giving me this error: File or assembly name Interop.SQLMO, or one of its dependencies was not found.
The file SQLDMO is a dll file i had to add to my project. i also try adding the file to the application folder before a went a head a build the project...but still it is having a problem finding it..
have any of you guys came across an error of this sort, if so, what was the solution.. i realise that i am having this problem with all the dll files that i had added to my project...please help
I am behind time with this project, my boss needs it like last week...but i can't package for them to use...
thanks in advance...
Nab
|
|
|
|
|
|
Have you created a Setup project for you application? When I use the Setup wizard it scans the application project for dependencies and adds them to the setup project. When running the setup.exe it installs all the files needed to run your application.
|
|
|
|
|
Yes i have created a setup project for my application but not with the wizard, i am going to try using the wizard and see if it helps out better, because i am also using a twain device and it is missing that file also.. Question?.. when i use the wizard..how does it know which application to package?
Nab
|
|
|
|
|
When the solution is open click File | Add | New Project and select the Setup wizard. In the wizard I normally select Primary Ouput File. When the wizard finishes you can look in the Solution Explorer to verify it added you dependencies.
|
|
|
|
|
Ok thanks..i am going to try it now.. will let you know if i got through...on more thing..have u seen my post on Twain problem...I need help with finding a Twain software which is free or any other suggestions as to how to capture images from a scanner or a digital camera and save that picture to a file as well as a database..
Nab
|
|
|
|
|
Why not use an off-the-shelf program to accomplish this?
|
|
|
|
|
if i could i would...but this is a custom in house system for doing company business...which meams only data specify by the company i can use..but thanks anyway..
Nab
|
|
|
|
|
i have changed the menu on my main screen but it has not changed when i run the program still has old menu in the run main screen.
|
|
|
|
|
try changing the text for the main menu in the property field..if not..try rename the file itself..
Nab
|
|
|
|
|
How can I programmatically set focus to a cell in a DataGridView?
|
|
|
|
|
i have drawn a circle,
i want to have control on that circle?event?do action
anyhelp for that?
Regards
Ramy
|
|
|
|
|
charchabil03 wrote: want to have control on that circle
What do you mena by "control"? Do you want to convert that circle TO a control?? What are you looking to do with this?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
What i want is that :
i have drawn a circle,after clicking on that cirle do action (ex:open an other form..)
Regards
Ramy
|
|
|
|
|
About all I can tell you at this poiont is to handle the click event of the control that you're painting the circle on. Anything other than that and you'll have to supply a lot more detail.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|