|
i want to make a textbox that would only accept numbers as an input...
can you please give me sample codes. thanx!
i am using vb.net 2002 (desktop application)
|
|
|
|
|
i already got the answer to my own question... in case somebody else will need it
here's what to do:
--put the following code in the Key_Press event of the textbox control.
If e.KeyChar.IsNumber(e.KeyChar) = False Then
e.Handled = True
End If
--then that's it! it would only accept numbers!
|
|
|
|
|
One update.
e.Handled = Not (Char.IsNumber(e.KeyChar) or Char.IsControl(e.KeyChar))
I have shuffled the code a little, but either way, the core thing is that you check Char.IsControl, otherwise things like backspace will not work.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
youre right! i didnt check that! thanx!
|
|
|
|
|
Hello,
I have written some reports in Crystal Reports XI Release 2 and calling them from VB.Net (2.0) application. Application resides on server and all clients (more than 300 machines) access/run it over the network.
Is there any way to deploy crystal reports on the server and all clients can be able run it or I have to install CR component on each client computer.
I am having the same problem with DSOFrammer control.
Your help will be highly appreciated.
Regards
Nas
|
|
|
|
|
|
Hello Ben,
Many thanks for your instant reply. You mean after installing this crystal reports server control on the server, I dont need to install anything on client machine in order to view reports within vb.net application?
|
|
|
|
|
Unfortunatly no. If you application is running the crystal report on the client PC, then it will also need to be installed on each client machine.
In my use of crystal reports I have a middle tier web service that actually creates the crystal reports then sends a word doc down to the client. So in that case since I am only running crystal reports in that middle tier web service, the report files and the install only need to exist on that web server.
In your case the report files and the crystal install will need to be installed on the client. Which is kind of a pain.
Ben
|
|
|
|
|
Many thanks Ben for your brief answer. I had a feeling that we gonna end up installing crystal reports on each client machine but wanted to check if someone has cheated crystal reports for this problem.
Anyways I appreciate your prompt responses.
Nas
|
|
|
|
|
Note, the link I provided in the above post is not a full version of crystal it is just what is needed to run the reports.
Ben
|
|
|
|
|
Hi all,
I have a MDI names as MainForm and in that MainForm MDI i have a menu item names as File
to the File Menu item i have a form named as 'Employees',
Here in my 'Employees' form i have a button names 'AddEmployes'
Whenever user clicks on 'AddEmployes' Button a form named as 'Employee Details' will opens,
NOW MY PROBLEM IS --When the user selects one employee department of 'Employee Details' Form and selects Save Button of 'Employee Details' Form
data of THE 'Employee Details' Form is saving and the 'Employee Details' Form is CLOSING..
ALL I need is i need to make the Employee details form to be in to the same state allowing the user to select another option..
I've tried in several ways,(taken Dialog box at last) and left with no answer,
I don't want to use DialogBox option,,,
Please help me
Thanks in advance
Prashanth
|
|
|
|
|
I have a program that search for files. I created an access table that include excluded files and file paths. Here are the fields:
ExcludePath: ExcludeFileName:
C:\Windows\Media\recycle.wav recycle.wav
C:\Windows\explorer.exe explorer.exe
C:\Windows\Help\camera.chm camera.chm
I need to know how to check this table to see if the file exist. For example, if the file exist in the db then add ExcludeFileName to listbox2.
jds1207
|
|
|
|
|
File.Exists
Christian Graus - Microsoft MVP - C++
"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 i want to fetch time frome system with milliseconds in the format of hr:min:s:milliseconds how we can do this
pls tell me if not possible inthis way then tell me some other way in which we can fetch the same or equivalent
with regards
Balagurunathan.B
|
|
|
|
|
|
try this
dim stringDate as string
stringDate = Format(dateValue,"HH:mm:ss")
--dateValue is the given date
--format function returns string
if you want to have a datevalue then try this:
dim newDate as datetime
newDate = Date.Parse(Format(dateValue,"HH:mm:ss"))
--hope this would help!
|
|
|
|
|
yeah, now add .fff to the format string to get fractions of a second.
|
|
|
|
|
I m using Visual Studio 2005. How can I drag and Drop Table From Data Connection Node of Server Explorer to Form. I have done it n Visual Studio 2003. But I m not able to do this in 2005. Does VS 2005 does not support it, or ther s a special method for that.
Thanks in Advance
|
|
|
|
|
Not sure about whole tables. I drag and drop fields from tables and views with no problem...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
hi
i am doing a project in which creating log files for the users signed on . its automated input process so i will be writing each and every input in log file .
log file is a .txt file i am appening the file using streamwriter
at the same time i am trying with another button to read the file using stram reader or any io.files.readalllines() but its not allowing to read. how i can read the file while some strea writes into it. please any one tell me this. i cannot close the stream each and every time as the process is automated for testing purpose.
with regards
Balagurunathan.B
|
|
|
|
|
What you want to do is impossible. You absolutely need to close the stream, in order to read it.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
but my doubt is if you r opening and editing a word document and on the same time if some other user on network trys to read they can open in read only mode and can read lastly saved one then why can us do the same programatically
thanks
with regards
Balagurunathan.B
|
|
|
|
|
Word handles this by creating a temporary file, which is the file that is opened for editing. Read only mode means it reads the entire file, then closes it, it doesn't keep it open.
Open a Word doc, then look in Windows Explorer, you'll see the temporary file there.
Christian Graus - Microsoft MVP - C++
"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,
I beg to differ: whoever creates/opens a file is in control regarding the
operations others can do to the same file.
one can easily share a file between threads and even processes; it suffices
to apply the correct FileShare value when creating/opening the file.
My example shows a first stream writing to a file it allows others to read,
and a second stream reading from same file allowing others everything:
string filename="streamTest.txt";
using(FileStream fw=new FileStream(filename, FileMode.Create,
FileAccess.Write, FileShare.Read)) {
using(StreamWriter tw=new StreamWriter(fw)) {
tw.WriteLine("Created new file");
using(FileStream fr=new FileStream(filename, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite)) {
using(StreamReader tr=new StreamReader(fr)) {
for(int i=0; i<10; i++) {
tw.WriteLine("line "+i);
tw.Flush();
string s=tr.ReadLine();
Console.WriteLine(s);
}
}
}
}
}
BTW the flush is there to undo the buffering that takes place in these streams;
without it there probably would be nothing to read when the short loop
terminates; for longer streams, flushing is not needed ! And normally
the reader should continue to read after the writer has done, my example does not.
PS: sorry for posting a C# example in a VB.NET forum !
|
|
|
|
|
hi Luc Pattyn
but its not working mate
i am appending the string
is it because of that something else
with regards
Balagurunathan.B
|
|
|
|