|
If you go to Jesse Liberty's site
http://www.libertyassociates.com/pages/book_edit.htm[^]
and download the source code for Programming C# 3rd edition then you'll find a (simplified) Fraction class that you could perhaps adapt for your purposes. It's in the Ch 6 folder.
Kevin
|
|
|
|
|
Re: Jesse Liberty - Programming C# - he has a VB .NET version of the same book with source code so you could download the source for that one instead.
Kevin
|
|
|
|
|
I appreciate for your info. I'll try Jesse's book.
bravo659
|
|
|
|
|
This sounds more like an issue with Math than it is VB .NET
It's just a matter of making the right calculations to display the appropriate whole number.
|
|
|
|
|
Oh no, i know how to calculate fractions without a problem, is that how do you use the textboxes to display fractions. That's the problem.
I've seen it done through C#, but I tried to use it in VB.Net, and it doesn't work. So the solution is in progrmming in VB.Net. That's all.
I appreciate for your feedback.
|
|
|
|
|
Hi All,
How to send a mail using fax server (using fax machine). What are the prerequists to develop the application. This I need to develop using Visual Basic.Net.
Thanks in advance.
Regards
DBKREDDY
|
|
|
|
|
|
Here is a control on a winform.
I want to create an array of this control.
In vb 6.0 , we just copy and paste the control, the compiler will create array of control automautically.
However, we could not do so in vs.net.
Maybe friends will teach me.
Thanks!
|
|
|
|
|
<br />
' For array of text boxes<br />
Dim txtBoxArray as TextBox()<br />
Dim x as Integer<br />
For Each ctl As Control In Me.Controls<br />
If TypeOf ctl Is TextBox Then<br />
ReDim Preserve txtBoxArray(x)<br />
txtBoxArray(x) = ctl<br />
x += 1<br />
EndIf<br />
Next<br />
You can access them like txtBoxArray(0), txtBoxArray(1), ect...
|
|
|
|
|
Do array of controls in your code
Contols like any object in .net
so you can create control of TextBoxs for example
Dim textBoxs(5) As TextBox
and access each control via index
MCAD
|
|
|
|
|
Is it possible to activate a winform using its handle?
For example, if you know the handle (intptr) and the window is minimized or behind another window. Is it possible to Activate the winform using that handle?
|
|
|
|
|
you could use interop to use the user32 dll
example here http://www.codeproject.com/vb/net/ActivateSingleAppInstance.asp
|
|
|
|
|
Is there a way without doing it with using the WinHelper? I've seen that link before...but I'm trying to look for another solution without using the WinHelper.
Any suggestions?
|
|
|
|
|
You don't have to put that stuff in it's own class. You can just put the same code into your form code if you want. But, keeping all of your Win32 wrappers in a seperate class like that makes it very easy to reuse without having to copy and paste gobs of code everywhere.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have 20 or so VB6.0 macros, including an AutoExec macro that I use in Word. Once in a while Users complain that as they type characters into a new, or existing doc, the characters are slow to appear on the screen. My macros only run at the opening of new documents, or the saving/closing of documents. All macros are called by Users via function keys. Only AutoExec is run when Word opens (if I understand the docs correctly). So I "think" none of my code is actually running while a User is in a new, or existing doc, and typing away.
What object do I test to see the current state of the char buffer that Word stores the characters as the User types them in ? I assume the chars are stored somewhere in an object in Word, question is what is it and can I access it and flush it to the screen if it's getting too big ?
Any ideas what is going on here ?
Ed
|
|
|
|
|
Ed Mansky wrote:
What object do I test to see the current state of the char buffer that Word stores the characters as the User types them in ?
There isn't one. The keystrokes are queued up in Word's window message queue waiting to be processed.
Since the message queue isn't being processed very quickly, the keystrokes aren't getting to the application code, so it looks like it's dragging. This can be caused by your macro code hanging up in a long running loop or some other code, even in Word itself, that is taking all this time to process.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Any way to query and/or flush the message queue of pending keystrokes ?
|
|
|
|
|
Nope.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Tell them to turn off background auto-save.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Thanks, I hadn't thought of that.
|
|
|
|
|
I have created a VB.Net application running on Win XP prof and when I run the program, all seems fine, but all of a sudden the program seems to shutdown. I have added Try-catch statements to all of my functions hoping to catch where it is failing, but no error message comes up. Can anyone help me with this?
Thanks
|
|
|
|
|
The only thing you can do is instrument your code and have it log what it's doing, like entering functions, function parameter values and return values. You'll get a better idea of where this sudden quit is occuring.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Having trouble deciphering the following code. Am I leaving something out or do I need to subtract something or am I way off in left field? Bold area is my main problem at this moment. Thanks
Private Sub Number_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Number.TextChanged
Number.MaxLength = 12
Dim Mystr As String
Dim ok As Boolean = (Number.IndexOf("-") = 3 And Number.LastIndexOf("-") = 7)
If Number.Text.Length = 3 OrElse Number.Text.Length = 7 Then
Number.Text = Number.Text & "-"
Number.Select(Number.Text.Length, 0)
End If
Mystr = Format(222 - 22 - 2222, "###-###-####")
If Number.Text.Length = 12 Then
Number.Visible = True
End If
End Sub
Believe me guys, I am totally confused.
|
|
|
|
|
What are you asking? Are you trying to figure out what the highlighted code does?
If so, it's checking two things. First, does the index of the first "-" character = 3, returning true or false. Then it AND's that to a check to see if the last index of "-" character is 7. The results is a boolean value, true of false saying if these characters are at those positions.
But, it has a serious flaw. What if there is more than two "-" characters in the string?
A better way to do this would be to accept only number characters, or to accept any characters and use the textbox's Validating event to reformat the text in the box.
When the Validating event fires, take the string in the textbox and strip out everything that isn't a numeric character. Then take the end result and make sure there are 9 characters (for an SSN anyway), if not, throw up a messagebox. If you have 9 characters, build a new string with the formatting "-" in it and set the textbox's Text property to that.
For example, I've seen something like this for text entry of a Social Security Number:
Private Sub SSN_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SSN.Validating
Dim tempSSN As String = String.Empty
' Create a temporary string that contains only the
' numbers in the original string as typed by the user.
For i As Integer = 0 To SSN.Text.Length - 1
If IsNumeric(SSN.Text.Chars(i)) Then
temp &= SSN.Text.Chars(i)
End If
Next
If tempSSN.Length = 9 Then
' We should have a string of numbers that looks like this: 295048397
' Reformat it to look like this: 295-04-8397
SSN.Text = String.Format("{0}-{1}-{2}", _
tempSSN.SubString(0, 3), _
tempSSN.SubString(3, 2), _
tempSSN.SubString(5, 4))
SSN.BackColor = Color.White
e.Cancel = False
ElseIf tempSSN.Length <> 0 Then
' If the length is now anything other than 0 or 9, clear
' the textbox and color it red to point out that we need a valid
' SSN in this box to continue.
SSN.Text = String.Empty
SSN.BackColor = Color.Red
e.Cancel = True
Else
' Since the SSN length is 0, it's OK to not have an SSN. Clear
' the textbox and return it to normal.
SSN.Text = String.Empty
SSN.BackColor = Color.White
e.Cancel = False
End If
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok let me see if I can transalte this to my telephone validater program and will repost because I know I will still be confused. Don't know how you guys got so good at this.
Believe me guys, I am totally confused.
|
|
|
|