|
hi i have to do a application i have to find a text given as input in the richtextbox
but i am not able to do that as its not points the cursor to the point where the text has to be find is there
with regards
Balagurunathan.B
|
|
|
|
|
balakpn wrote: but i am not able to do that as its not points the cursor to the point where the text has to be find is there
That's because you have to write the code that highlights the found text. It doesn't happen automatically.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i am not able to find that will u help me
with regards
Balagurunathan.B
|
|
|
|
|
What do you mean "not able to find that"? Of course you can't find it, you haven't written it yet!
Start with the Find() method of the RichTextBox. It'll return the text position of the first occurance of whatever you want to find. You the use that value to set the RTB's SelectionStart property and the length of your serarch term to set the SelectionLength property to highlight the text. Then call the RTB's ScrollToCaret method to make sure that the user can see the highlight.
The rest is left up to you as an exercise.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
in my application i am using database connection where ever i am opening the connection i have used con.close to close the connection but its not getting closed
with regards
Balagurunathan.B
|
|
|
|
|
.NET uses connection pooling. The connection will stay open in the background and when you create a new connection you'll get the previous (pooled) connection. This saves a lot of time because creating the initial connection can be time consuming.
|
|
|
|
|
so if i want to close it means wat i have to do
why i am asking is then only i can continue the next process
it is must for my project
with regards
Balagurunathan.B
|
|
|
|
|
What process? Why do you have to do this?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
in my application i will be using many temporary tables and later if i want to give a fresh process without closing the application i have to delete the database as i dono how many tables r there even if i know that it will be a very time consuming one so ineed to close the database and delete it later i will create it .
although its the bad practice i have to do that
with regards
Balagurunathan.B
|
|
|
|
|
I had a similiar issue a while back - I'd be updating thousands of records at a time, but eventually ran into problems with time out errors with SQL. I thought I'd done everything right (followed Microsoft Best Practices)
But the problem was not really with wondering how to forcefully close a connection (my first guess) or to disable connection pooling, it was with how I created the connection in the first place and my management of that connection for the lifetime of the application.
If you've got code that constantly opens and closes a connection to the exact same datasource, I'd maybe rethink that code and only open it once and close it once (with capability to reopen if the connection is lost). I've found that even with connection pooling working and all, when you open a connection more than once, more than one connection is created to the data source.
|
|
|
|
|
so i have to open it once and have to close the connection only once is it
with regards
Balagurunathan.B
|
|
|
|
|
Depends on how you are using the connection really - I find that if I am using a database connection that I know that has the potential for more than a few transactions I'd think about how I am opening and closing those connections.
What I used todo is open and close a connection on each transaction to the database. This worked fine in most test cases, but as Colin mentioned, it takes time. So as insert would open the connection, do it's stuff and then close. Problem I found was that even though the connection string was exactly the same I'd be creating something like 20 connections into the database for the one instance of the application. Maybe it was something dodgy in my code (most likely)!
When you need to update records in the thousands or millions, this is just really in-efficient.
Then I went to opening the connection when the class used to represent the database (in a nutshell) was instaniated, then closed in the destructor. This works fine now and even in a tiered architecture (albeit with some changes) it generally scales quite well.
|
|
|
|
|
Hi, I hope some one can help. I have a really sill query.
I am new to VB and need some help.
How do i asign the date to a variable?
I have tryed utilising "date" and "datetime" but they return zero values
If someone could please help me with the syntax I would be very greatful. Thanks Jon
|
|
|
|
|
|
he means:
YourString = DateTime.now
Posted by The ANZAC
|
|
|
|
|
Dim dtmDate As DateTime
dtmDate = DateTime.Now()
label1.Text = dtmDate.ToString("D")
Magesh
|
|
|
|
|
Thank you for the responses they have helped no end. Jon;)
|
|
|
|
|
Hi all,
In VB2005 I want to create an structure that some of its members should be declared with the WithEvents statement as they generate events that I'd like to handle. The compiler doesn't permit to declare members of an strcuture with WithEvents. Is there any way to do it?
thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
You'll have to use a class instead. Here is a link defining the differences. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconStructuresAndClasses.asp[^]
Although a structure's methods can handle events the method must be shared and the handler must be added using Addhandler. To quote the info in the link:
"A structure procedure can handle events only if it is a Shared (Visual Basic) Sub procedure, and only by means of the AddHandler Statement; any class procedure can handle events, using either the Handles keyword or the AddHandler statement. For more information, see Events and Event Handlers."
|
|
|
|
|
Is it possible to draw a line on design page in Windows.net
Nana
|
|
|
|
|
I don't think so. To create a line on the form you'd need to actually draw one in the paint event, which would be done during runtime. However, you could use a panel or another appropriate control set it's backcolor to black (or whatever you want) and then set it's height and width as desired to create your line.
|
|
|
|
|
Thanks for your reply.
But did it in other simpler way.
I asked my Design team to give a picture of a line.
and added it in a picture box.
Hows that?
Nana
|
|
|
|
|
Hi i have tried menubars in my form,
i got the solution........,
But now i need that menubars want to display based on the user rights...,
if he dont have rights for some menus that wont display,when he logged on in that time,
i tried that probs using some flags....,
but i didnt get solution....,
anyone plz help me......,
i need that codes........,
Regards,
Magesh
Magesh
|
|
|
|
|
not work with flags?, can you show me the code?, you systems must check the username, set flags to this users and enabled/unabled menus.
|
|
|
|
|
Hi used javascript and displayed menubars in my form..,
See each menu have submenus...,
i given for each form pageno(its the flag)...,
my ques is very critical,
take eg like..
two menus are there...,
in that two menus have 3,3 submenus..,
now one user can access in that first menu 2 forms and second menu 1 form....,
another can access in first menu 3 forms and second menu two forms...,
now how u can tell...,in that login page these are the forms menus only want to display like......,
regards,
Magesh
|
|
|
|