|
Thanks for your reply, but this will not work. Reason is,
For example, let my format string is ###,###.00. When the user types 1234, the selection start will be 4. But due to the format happening, the string will be changed (while typing itself), to 123,4. Now I need to place the string at the 5th position and not in the 4th position. And since the format can be dynamic, I can't rely on SelectionStart, but I need to find the current caret position of the last character typed.
|
|
|
|
|
"I need to find the current caret position of the last character typed."
Ok, I understand now. Your first post wasn't very clear on what you needed. For finding the Caret position, there is an API call GetCaretPos().
Public Declare Function GetCaretPos Lib "user32" (ByRef pt As System.Drawing.Point) As Integer
And it is used like this:
<br />
Dim pt as System.Drawing.Point<br />
<br />
GetCaretPos(pt)<br />
<br />
Msgbox("The cursor is at X:" & pt.X & " Y:" & pt.Y)<br />
Basically, since the API call uses a ByRef variable, the variable passed to GetCaretPos() holds the X, and Y location of the cursor.
Another API function I think you'll find useful is SetCaretPos
Public Declare Function SetCaretPos Lib "user32" (ByVal x As Integer, ByVal y As Integer) As Integer
Hope this helps!
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
i want to make an Event Calendar in Windows Application by using vb.net. Also I have to retrieve the events ( the event name ) from the database and appear in the calender in the cell of specified date. Here i can add more than one events. what should i do ? is it possible to customize the month calendar tool or is it possible with 31 text boxes and labels to specify the date ?
|
|
|
|
|
I have two .txt files with information on them. I need to create a Random Access File with the data. How do I go about doing that? (As you can tell I’m a beginner)
My book doesn’t really cover this issue , and I really want to learn how to do it.
Doirs
|
|
|
|
|
why cant i create a data report..
|
|
|
|
|
Can't help you unless you get alot more specific about the problem. Error messages help alot...
RageInTheMachine9532
|
|
|
|
|
I feel like a complete idiot for asking this question, but I havnt programmed since high school ( been over 4 years ) so .NET is almost like im relearning everything. Anyhow, how on earth do you get input in a VB.NET console application?
|
|
|
|
|
Hi there. Use the System.Console object -
dim s as string
Console.WriteLine("Enter your name:")
s = Console.ReadLine()
|
|
|
|
|
In the property browser for a multi line textbox the lines property says: String[] Array and can't be edited in place, one has to use the editor. How do I do that for my classes which can be edited in a property browser so that it just says something which can't be changed and the user has to use the provided editor?
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Hi,
Here's my problem. I want to open a form then check to see if there are any records present in the Access database that i'm connected to. If there are no records I want the form to close. I keep getting something like can't close the form while creating handle. To get over this I used the mouseMove event so that the correct code would be called after the form has loaded. This works but it's not ideal. Has anyone got any better suggestions as to how I do this.
Thanks in advance
|
|
|
|
|
I'm not sure where you're trying to close your form that's causing you to get this error, but the Form class has a HandleCreated event that you can handle and close if needed.
The ideal solution, however, would be to separate your application logic from your UI and show your form only after you've determined it's appropriate.
Charlie
if(!curlies){ return; }
|
|
|
|
|
I have a class that I want everything in it to ne shared, can events be shared? It allows me to write:
public shared event DoSomething()
but how do I subscribe to those events in my code? WithEvents gives an error.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
WithEvents wouldn't make any sense here because you're not subscribing to an instance event, but rather an event of the class itself.
Use an AddHandler statement to add an event handler for a shared event.
' Note that you're subscribing to an event of MyClass itself,
' not an instance of MyClass
AddHandler MyClass.EventName, AddressOf NameOfMethod
Charlie
if(!curlies){ return; }
|
|
|
|
|
Thanks for that, I wasn't thinking straight
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Im trying to access a Public Property in a form with name Principal(mdiParent) from another one (mdiChild) but i can't get acess whats wrong ?
Private _IDTechLOG As Integer
Public Property IDTechLOG() As Integer
Get
Return _IDTechLOG
End Get
Set(ByVal LeID As Integer)
_IDTechLOG = LeID
End Set
End Property
|
|
|
|
|
XGaMeS wrote:
i can't get acess
What does this mean?
Are you casting the parent form to the correct type? Post the code that's not working to get a more specific answer.
Charlie
if(!curlies){ return; }
|
|
|
|
|
I wasn't seeing the property, and yes it was c casting error
I am a newbie
|
|
|
|
|
Is it possible for a VBScript (i.e. test.vbs) to actually know it is called "test.vbs"?
I seem to recall something in VB Using "Application" "object" for finding out that kind of stuff.
~Mike Stanbrook
modified on Saturday, January 22, 2011 10:21 AM
|
|
|
|
|
WScript.Echo WScript.ScriptName
RageInTheMachine9532
|
|
|
|
|
|
Adding a related question to this thread:
Assuming you don't know it (all or at all) after importing VBScript code, or instantiating a COM object, is there any way to get a list of methods (and perhaps properties) of a VBScript class and/or COM object (built from C/C++ or Visual Basic)?
Basically something like .NET reflection for VBScript/COM.
"A good scientist is a person with original ideas. A good engineer is a person who makes a design that works with as few original ideas as possible." - Freeman Dyson
|
|
|
|
|
Hi everybody.. how can I search a string without caring about the case\
eg..
<br />
Dim str as String = "he HE hE He" <br />
Dim r as Integer<br />
Dim c as Integer<br />
while(r<>-1)<br />
r=str.IndexOf("he",r)<br />
If (r<>-1) Then<br />
r+=2 'adding 2 (he has two letters) so it will start looking at position it first found +2<br />
c+=1<br />
End If<br />
End While<br />
Instead of c=4, I'm only getting c=1
How to search a string in case insensitive?
|
|
|
|
|
r = str.ToLower().IndexOf("he", r)
Charlie
if(!curlies){ return; }
|
|
|
|
|
I'm having issues writing text to a tiff file. However I have no problems saving text to a Bitmap.
Here is an example of the code that works with Bitmap:
Dim objBitmap As New Bitmap(600, 600)<br />
Dim objTextBrush As New TextureBrush(objBitmap)<br />
Dim objFont As New Font("Verdana", 20, FontStyle.Bold, GraphicsUnit.Pixel, 0)<br />
Dim objGraphics As Graphics = Graphics.FromImage(objBitmap)<br />
<br />
objGraphics.DrawString("Test Text", objFont, Brushes.Black, 0, 0)<br />
objBitmap.Save("test.bmp")
This code works great! But I need to a way to write to tiff.
The code below should work but fails. It returns a black tiff image:
Dim objBitmap As New Bitmap(600, 600)<br />
Dim objTextBrush As New TextureBrush(objBitmap)<br />
Dim objFont As New Font("Verdana", 20, FontStyle.Bold, GraphicsUnit.Pixel, 0)<br />
Dim objGraphics As Graphics = Graphics.FromImage(objBitmap)<br />
<br />
objGraphics.DrawString("Test Text", objFont, Brushes.Black, 0, 0)<br />
objBitmap.Save("test.tiff", ImageFormat.Tiff)
Any help would be greatly appreciated. In return what I would like to do is build a C# class that will save text to an image in different formats and make it available for free. I have tried tools like CoolWatermark, but it has the same issue.
Ryan
ryan@edevers.com
|
|
|
|
|
hello,
this link - there is a nice example of line charting , but the code is in c#. I attempted to convert it to vb.net but have some issues.
does anyone have vb.net code sample of line charting - specifically, plotting multiple lines?
http://www.codeproject.com/aspnet/LineGraph.asp
or ifyou email me directly I can share what I have so far, maybe someone can get this to work for me. thanks
(bsharris@optonline.net)
bev
|
|
|
|