|
Please don't cross post.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Your asked essentially the same question 7 hours ago... try to work it out for yourself.
Write it out on paper and work through the problem.
|
|
|
|
|
<br />
Dim Count as Integer<br />
For each i in MyArray<br />
if i.contains = "YourString" then<br />
count += 1<br />
next<br />
Something like that?
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
I look at Microsoft, and turn to my poster on the wall saying: "Bang head here in case of stress".
|
|
|
|
|
Can anyone please tell me how to integrate VB.Net codes into powerbuilder in order to run one application
modified on Tuesday, August 12, 2008 8:46 AM
|
|
|
|
|
Do you think any body has this much time to read your code.
Please be specific of your requirement
|
|
|
|
|
Hi
I want to make a formula builder, in which user can take his own variable and by using that variable he can make his own formula and can check it whether its valid or not and when he enter a value for specific variable then he can get result.Its basically used in Payroll System
Like
if user takes one variable 'X' and make a formula like (X/24)-1
now when user select a different value for X then he can get result
modified on Wednesday, August 13, 2008 1:23 AM
|
|
|
|
|
OK - sounds like fun. Do you have a specific question ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I want to check whether a given text File is Already Opened or not. I am using Visual Basic 6.0 in the Windows XP OS.
I am using the following code. It works for .doc, .xls and .mdb. But its not working for .txt file type
Code:
--------
Public Function IsFileOpen(FileName As String) As Boolean
On Error GoTo ErrHandler
Open FileName For Binary Access Read Lock Read As #1
MsgBox Input$(LOF(1), #1)
Close #1
Exit Function
ErrHandler:
MsgBox "File is Already Opened"
End Function
|
|
|
|
|
Hi,
Try the following code:
BEGIN CODE
Try
Dim fs As FileSream = File.OpenWrite(strFileName)
If(fs == null) Then
// your Code
End If
Catch e As UnauthorizedAccessException e
/The file is open by another app
End Try
ENE CODE
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
The code will work, so long as the other app keeps the file open. For instance, Notepad does NOT do this. It opens the file, reads the entire contents, then closes it. Only then do you get to the see the text in Notepad. There is no way to tell if this has happened or not...
|
|
|
|
|
i need theway how to use dataset in web page to fill crystal report and run it
i tried to load data on dataset after that call that dataset from project in crystal report (ado.net) database so can any one help me please
|
|
|
|
|
We have an ASP.NET forum.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I have a group box called box. I would like to create a label (label1) that I want to create in runtime and add it to the group box. How do I go about doing that?
I can create it in runtime just fine. I just can't seem to get it to be inside the group box.
Thanks in advance.
|
|
|
|
|
box.Controls.Add(myNewLabelThatIJustCreated);
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I have done some searching and can't find the answer to this one anywhere.
I have a multiline textbox on a form that shows 2 lines of text on the form. I have restricted it to 200 chars because the report page that it prints on can display 200 chars in 2 lines. My problem is users can press return as many times as they want and put as many lines of text in the box as is possible before they use the 200 chars. Since the report will recognize a CRLF character and move the text to the next line if they put more than 2 lines of text in the multiline text box only 2 of those lines of text will print no matter what. They are wanting to restrict the data entry box so that only 2 lines of text can be entered even if the character count is less that 200. Is there a way to do this?
I'm coding in VB.net with Visual Studio 2005 and using Crystal Reports XI for my report. I can't manipulate the report side of things to print more than 2 lines because the way the report is laid out there is no room.
Thanks in advance to anyone who can help.
Judy
|
|
|
|
|
1. Count the number of CRs in the textbox.text and beat on the user if there is more than 1
2. Use the keydown/up events to interactively manage the characters typed into the textbox.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks. I was getting to that I just was wondering if perhaps there was a setting I had missed.
This points me in the right direction.
If the beatings worked I wouldn't need to do this. LOL
Judy
|
|
|
|
|
Ok, I've counted the number of returns in the box and can display a message but if I tell it to supress the keystroke in the keydown event it still enters the return in the box.
How do I stop the return from being entered?
Thanks,
Judy
|
|
|
|
|
Never mind. I quit displaying the message explaining that they couldn't add anymore lines and then the key supression started working.
Thanks for all your help,
Judy
|
|
|
|
|
Try the keyup and test, keydown happens BEFORE the key is entered.
I don't think you can actually suppress the enter key from being pressed. I have always found interactive management of what the user does to be painful, I almost always let them do what they want and then clean up after, probably using the on leave event.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually it is suppressing the keystroke on the keydown event. I created a derived class and added the count returns as a property and put the keydown event code override in the class and it works well. I also added an event for the text change to keep track of whether or not they go in and delete text and/or a return so that the count will remain accurate while they are working in the text box.
Private Sub MyTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If (e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Return) Then
If Me.CRLFCnt > 0 Then
e.SuppressKeyPress = True
Else
Me.CRLFCnt += 1
End If
End If
End Sub
As I said it took me awhile to figure it out and I had a message box popping up to tell them they had tried to put in too many lines and for some reason that caused the suppress method not to work. I tried putting the message box in the keyup event but then it just looped if you hit return on the 'OK' button. If you clicked it with the mouse it went away but we try to code things so the users don't have to take their hands from the keyboard any more than possible.
Thanks for your help it did point me in the right direction and saved me a lot of time.
Judy
|
|
|
|
|
My pleasure. I see you have run into the modern developers curse, if you hold your tongue just right and face into the wind, it works. Now you can understand why I hate interacting with the textbox events.
Well done.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Does anyone know of functions that may be accessed via VB code that locate the mouse in a given location, then create a mouse click event.
The idea is to control an external application by locating the mouse over a button on that application then producing the click event within that application.
I know of the "SendKey" and "SetForegroundWindow" functions, but the external application doesn't have a hot key assigned to the commands I'm trying to access.
Thanks,
Andy
|
|
|
|
|
How to findout the total number of elements stored in array
i created array of string and storing employee name into it from database . how i come to know that how many times employee name repeates in an array
like this
For i = start_cell_number To end_cell_number
Dim testarray(48) as string
testarray(i) = (dr("User_Name").ToString())
Next
how i calculate total number of repetition of user name inside array?
any suggestion or link is highly appercited .
Regards
Rameez
|
|
|
|
|
use
testarray.Length
to find total no of elements stored in array
|
|
|
|