|
You can you on keypress event of text box. Handle e.keychar not a character and display msg.
|
|
|
|
|
Thanks people , not able to test any of suggestions as my computer is down , but when I get a chance, I will let you know how I get on. Thanks again for the help.
|
|
|
|
|
|
validate each keypress on the textbox
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If InStr("0123456789", e.KeyChar) < 1 Then
e.Handled = True
End If
End Sub
|
|
|
|
|
Hello everyone:
Try to load a text document into my vb.net program using the code below. nothing happens when I click on the button to execute the method below.
Private Sub Contents_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Contents.Click
Dim openFile As System.IO.TextReader
openFile = System.IO.File.OpenText("..\User_Manual.txt")
Dim MyFileContents As String = openFile.ReadToEnd
openFile.Close()
End Sub
what am I omitting here?
Thanks in advance
|
|
|
|
|
waner michaud wrote: what am I omitting here?
Who knows? What are you expecting to happen with this code?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Well, for one thing, you're reading the file contents into a variable... and promptly doing absolutely nothing with that variable! If you want something to happen on-screen, you'll need to provide some form of user interaction - say, put the contents of the file in a RichTextBox or something...
|
|
|
|
|
You are omitting to display read text. You can display it in message box or in label
|
|
|
|
|
Next time, put a breakpoint on the first line in the method, step through the code, line-by-line, and watch what happens in your variables and. That stuff under the Debug menu is there for a reason.
|
|
|
|
|
Thanks lot guys I got it to display into a richtextbox. But this is not I want to accomplish..
Instead of using a text file, i rather like to use a word document..
Ok now i have this scenerio:
I load a word doc using the following code:
Dim MSWord As New Microsoft.Office.Interop.Word.Application
Dim WordDoc As New Microsoft.Office.Interop.Word.Document
WordDoc = MSWord.Documents.Open("E:\Manual.doc")
MSWord.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize
MSWord.Visible = True
Document loads fine...
However, when I click X from word to close the application, got a message saying that
1) file is being used by another application or user
when X or OK...
2) Ask to save as
click cancel the document is now closed
click X to close the word application
3) changes have been made, do you want to save...
click NO...it is now the word app is closed.
I want to close ms word application without having to go thru the three warnings mentioned above.
I am doing this to load a user manual as word document for a small application in vb.net.
On the main menu, have help button that will load this word doc as a manual..
Also, I want this document to be on read only mode so that user cannot edit the document.
Your guidance is very well appreciated..
Thanks in advance.........
|
|
|
|
|
See here[^] for opening document as readonly, and here[^] to release it to the user.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hello !
in my project (Vb.net 2010/Entity framework / SQL server 2008r2) i have a form with bindingsource.
i wan'r to know what is the difference between these 2 instructions :
1.Mybindingsource.datasource=From t in context.mytable where .... some conditions
Select t
2.Mybindingsource.datasource= (From t in context.mytable where .... some conditions
Select t).Tolist
If i use the first instruction , all the records are displayed correctly in form , i can delete records , i can update records, but if i try to add a new record on bindingsource i get an error : " Item cannot be added to a read-only or fixed-size list "
if i use the second instruction , all the records are displayed correctly in form , i can add new records , but if i try to delete record ( with context.mytable.deleteobject(myrecord)) the record is deleted from database (i have checked) but still exists on bindingsource until i close and reopen the form.
Which of instructions should i use and what can i do for my problems ?
thank you !
|
|
|
|
|
I want a drop-down checkbox; a combobox that when you click on it, it will offer the ability to tick off multiple choices. I'm working in VB.Net 2010.
I came across (and was referred to) an article...
http://www.codeproject.com/KB/combobox/extending_combobox.aspx
I gave this article a read, downloaded the code, compiled it in C# then added the DLL as a reference in my VB.Net 2010 project. Unfortunately, that's all the further I've been able to get.
I cannot get the controls to appear in the toolbox and this is my first time trying to do something like this so I am admittedly lost. Anyone can help?
|
|
|
|
|
Better post the question in the forum of that article Clickety[^]
|
|
|
|
|
Noctaire wrote: I want a drop-down checkbox
As a user, I must say that I don't like 'em.
Noctaire wrote: I gave this article a read, downloaded the code, compiled it in C# then added the DLL as a reference in my VB.Net 2010 project. Unfortunately, that's all the further I've been able to get
Right-click on the solution, choose "Add project" and add the complete project to the solution. Rebuild the solution and check out the designer - it should be there.
Bastard Programmer from Hell
|
|
|
|
|
Created a User Control Who Hold The List and Show the Filter Data As User Type In Control. I have a problem with it that when i place this user control in panel or other container control then the list is hide in the container control. it not appera above the container control as combo box...
|
|
|
|
|
Some remarks;
- Post some code; it sounds like some controls aren't added, but it's all just guessing until you post a piece of your code.
- Reposting your question isn't good form; it looks lazy and impatient - you post a question and wait for an answer.
- Visual Basic 6 has been deprecated a few years ago. Existing projects should be moved to .NET, before they become 'dead' projects. Unlike Pascal, PHP and others, VB6 is closed source, and will be leaving the market at a specific point.
Bastard Programmer from Hell
|
|
|
|
|
I Created a User Control Who Hold The List and Show the Filter Data As User Type In Control. I have a problem with it that when i place this user control in panel or other container control then the list is hide in the container control. it not appear above the container control as combo box...
|
|
|
|
|
Try making the height of the control larger. That should help show part of the combo drop down. This is not a fun exercise. To do it properly you'll need to create a dialog box, that pops up in the right place, determining if should drop up or down. And then the hard part. Working out when it loses focus.
Enjoy
"You get that on the big jobs."
|
|
|
|
|
dear friends,
I need to get picture of each box on the conveyor band while they are on the move. I can get video stream of conveyor (of course) but I don't know how to get pictures of them.
I believe algorithm has to separate each object with the distance among them and when new object come into sight, should take the picture. assuming that the belt (means background of image) is black, algorithm can process image by contrast. but I need to get each objects picture ONCE. box sizes are different so I cannot use belt speed, timings, etc. I need to "understand" which object is where on the video stream.
any ideas please ?
|
|
|
|
|
aykut canturk wrote: any ideas please ?
Teaching the computer to "count" different kinds o' sh*t it don't recognize is a lot more expensive than a simple circuit. Most shops that sell shoes go "ding" when I walk through the door.
Bastard Programmer from Hell
|
|
|
|
|
im a first year student as an it i wonder about the visual basic ahm could anyone teach or give me example of codes for visual basic
|
|
|
|
|
|
Hi!
How to print a BMP graphic in Zebra TLP2844, using VB6?
Thanks
|
|
|
|
|