|
There is a FormatCurrency method that can be called to do the work for you.
It takes a number of parameters, which allow you to include things like leadin 0's, ()'s for negative numbers etc.
|
|
|
|
|
As mentioned, there is a FormatCurrency function, but if you do not what the currency symbol, the the FormatNumber may be a better option.
Also, I think I would use the Leave event of the TextBox, rather than the LostFocus event.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Mr Kreskowiak,
You stupid person.
I retired a few years ago. I bought a laptop for fun and enjoyment - learning visial basic has become a very satisfying hobby. I have no grandchildren and my wife recently died. Inane and ignorant remarks is obviously your low standard. I have not conned anybody.
I have posted genuine questions in these pages because I enjoy learning VB
Get your facts right before posting pathetic and remarks.
Stephen Comfort
Thanks for your help and advice!
Steve
|
|
|
|
|
Not even remotely the right forum for this, but to respond:
We are flooded here constantly with people asking questions like yours. Questions that either have no real world use and are someone's homework ( which is why you got lots of people trying to help you work towards the solution, the assumption being that giving you the solution would be doing you a disservice, because it would stop you from actually learning, or learning how to learn, if you were a student in a course ), or, worse. that are the paid work of some third world outsourcer who can barely type and who has in effect taken paid work from the very people who they then ask to do the work for them. People like yourself, who are just learning for fun, are such a minority, that they are hard to spot. I know that Dave, like myself, puts a lot of time into helping on these forums, BUT I also know we both try to lead the horse towards water, without actually pushing them into it, that is, to encourage people to use google, to buy and read books, to give them a nudge in the right direction, but not to write outright solutions to simple problems. Neither of us does this to tease or upset, we do it so that people who really want to learn, get help, and people looking to get free course credits, do not succeed. Again, that's the majority of what we see around here.
I am sorry for your loss, however, it's not really relevant, it shouldn't change how you're treated in a public programming forum. I'm sure that understanding where you're coming from in your approach to computing will color how anyone who reads this treats your questions in future, I can only state again, you've walked into a world where people who don't want to learn, try to get us to do paid work for them, and it's against that backdrop that it was assumed that you were trying to get us to do your paid work or homework for you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
OK, since the gloves are off...
BluesEnd wrote: Get your facts right before posting pathetic and remarks.
Facts?? The only facts I had were the ones you posted in your orignal post, which wasn't much and didn't include your life story.
You sounded like every other idiot who comes here looking for us to do their work for them because they went to RentACoder and got some schmuck to pay them to do a project they're nowhere near qualified to write. After seeing that 20 times a day around here, it gets a little old. I'm sorry you got splashed by the artillery shell I lob at every one them.
|
|
|
|
|
Having a burst-out on the internet will get you nowhere.
History says you are likely to be ridiculed.
Sometimes it is just best to swallow or ignore another person's opinions.
In fact, why should you even care about the opinion of some one you dont know?
And the last tip. Never expect to win an argument on the internet
|
|
|
|
|
Hi.
First, you seem to be clueless about the net and forums. In most forums, such an asinine post is a guaranteed way to get banned! Especially since it's a direct attack.
BTW: I've was on email distribution lists before there was a "net". So, I'm about as far from being a newbie on the net as is possible.
Second, gee, guess the type of people that are on this forum. I taught Computer Engineering for 8 semesters. I taught everything from freshman programming to senior labs. I was also responsible for introducing a new course, and directly involved in the change over to a different programming language for a course. So, I know very well what the level of questions that a person asks implies about the poster.
I see by your profile, you've been a forum member for over two years. In that case, your question doesn't make any sense to me.
To be blunt, your question shows a complete lack of experience. I'd expect a freshman to know how to do what you asked by mid-course. And, that's with a freshman software course that's required by non engineers (such as math/science majors, etc).
Also, your question sounds a LOT like a homework question. People know, I'll quickly blast someone that I think is asking for code for their homework question.
Last, regardless of what you say, MY feeling is that you asking about a homework question.
Just my two cents....
______________
Joe
modified on Monday, September 21, 2009 3:00 AM
|
|
|
|
|
Opps,
I forget to add.
Websites are private operations.
Under the LAW, a person has ZERO RIGHTS in a forum. Is that clear - *ZERO*!
The web site owner has FULL CONTROL and 100% right to ban/accept anyone FOR ANY REASON THEY FEEL LIKE!
A web site or forum is NOT, I repeat - is NOT, a public right.
Of course, the standard laws still apply like libel, and such.
I've had my web sites for ~15 years. I've managed internal specialized websites for some companies that I worked for. And, I help friends manage their own small business web sites. So again, I'm far from a newbie when it comes websites, the law, and so on.
FWIW: I see a ton of copyright violations on websites and forums today. And, anyone that thinks that a Fortune 500 company doesn't know about the copyright violations is a fool. It's all a mater of what makes sense (and cents - as in cost ) for a company to go after. One of my former co-worker friends is a company lawyer that is involved in exactly that type of stuff.
So, just because you see someone get away with something, that doesn't mean that it's legal, proper, or allowed for other people.
I figured that you might be interested in the above.
__________
Joe
|
|
|
|
|
Hello every one
I got this code and i get figer out what is the problem with it
i get a green line under the first End FUnction and i dont no why
Can anyone help me out ?? please Thanks
Public Function whichbuttonpushed(ByVal _sender As String) As String
Try
SetActiveWindow(8975651603260375040) 'Set focus Active window
'I found this number("8975651603260375040") via getactivewindow method.
Select Case _sender
Case "btna"
keybd_event(VK_A, 0, 0, 0)
keybd_event(VK_A, 0, KEYEVENTF_KEYUP, 0)
shiftrelease()
altrelease()
leftaltrelease()
Case "btnb"
keybd_event(VK_B, 0, 0, 0)
keybd_event(VK_B, 0, KEYEVENTF_KEYUP, 0)
shiftrelease()
altrelease()
leftaltrelease()
Case "btnc"
keybd_event(VK_C, 0, 0, 0)
keybd_event(VK_C, 0, KEYEVENTF_KEYUP, 0)
shiftrelease()
altrelease()
leftaltrelease()
End Select
Exit Function '<=== green line under this
Catch ex As Exception
Exit Function
End Try
End Function
|
|
|
|
|
Your Function does not have a return value? Change it to a Sub or return something.
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
Thanks Andy works perfect now
Bob
|
|
|
|
|
My pleasure.
A little tip, when there is a green line under something, hover your mouse over the text and the intellisence will give you a hint as to what is wrong.
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
Also, 2 things just for your information:
1. like Andy_L_J already implied, you should use a function when you want the code to return some value. For example:
MsgBox("Half of 11 is " & Half_Is(11))
Private Function Half_Is(ByVal MyNumber As Double) As Double
Return MyNumber / 2
End Function
Otherwise use a sub.
2. When you write a function or sub, you do not need to explicitly tell the code to exit the function or sub at the end, nor in the catch clause (that is why you got the green squiggly line). Your code will exit there anyway.
Use Exit Function or Exit Sub somewhere in the middle, and only when you don't want the rest of the function's or sub's code to be executed.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks Johan
that help me out i apreciater that
to bad your at the other end of the world or i would buy you a beer
Thanks
Bob
|
|
|
|
|
No problem, if I would have liked beer, you could have sent it to me
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thats to bad you dont drink beer
i could send you some canadian whisky hehe
do you know if this post is about me ???
Re: Stupid remarks by stupid people who are an MVP
i was just going to add a new post not sure if i shold now
or maybe you will know i want to have a form animated press a button and the
forme will slide up for the bottom of the screen and press the button agine and it will slide down
Thanks agine for your help
Bob
|
|
|
|
|
The stupid people post was not about you, don't worry. The guy was not talking about the people asking questions, but about the people answering them.
As far as I can tell, your questions have been good so far.
Making a form slide in or out of view should be possible, but where will you put the button?
You better post a new question about it, because I am not sure I can help you with this one.
My advice is free, and you may get what you paid for.
|
|
|
|
|
ok good i was woried about that for a sec
i got the animation figerd out google helped me
it was pretty easy
are you going to give me your adress so i can send you some canadian Whisy hehe
Thanks
Bob
|
|
|
|
|
I'll tell you what, I'll drink one to your health on my side of the globe, and we'll call it even
My advice is free, and you may get what you paid for.
|
|
|
|
|
Dear All,
I have one query regarding copying items from a datagridview into another. It is as follows:
I have two forms, Form1 and Form2.
In Form1 I am doing following :
I have a datagridview1, which has 4 columns, "Name", "Age", "Salary", "Date" .
I Filtered this datagridview1 by "Date" and count the number of rows, say e.g. 10 rows.
What I want:
In Form2 :
I want to get those filtered rows and populate them in other Datagridview2 in Form2.
Also, I want to select only "Name" and "Age" column from Form1 Datagridview1, and populate into
Datagridview2 of Form2.
Overall, out of 4 columns in Datafridview1, I want to populate Datagridview2 of Form2 with Filtered Rows and with only two columns, say only "Name" and "Age".
Hope My query is clear, Kindly suggest me how to proceed with this.
Thanks and Regards
R.S.
|
|
|
|
|
<br />
...<br />
Dim dt as New DataTable<br />
dt.Columns.Add("Name")<br />
dt.Columns.Add("Age")<br />
<br />
With dgv1<br />
For Each dr As DataGridViewRow In .Rows<br />
Dim obj() As Object = {dr.Cells("Name").Value,dr.Cells("Age").Value}<br />
dt.Rows.Add(obj)<br />
Next<br />
End With<br />
<br />
frm2.DGV2.DataSource = dt<br />
<br />
If you are using a DataSet/DataTable to populate your initial DGV then create a DataView of the DataTable and use that as the datasource for your second DGV.
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
Thanks Andy, I am not getting one thing.
Which part of the code will be in Form1 and which will be in Form2.
I mean, Datagridview1 is in Form1 and Datagridview2 is in Form2, so how to access the Datagridview1 rows from second form form2.
Can You please clarify this?
Thanks
|
|
|
|
|
Code In Form1 - I assume you open Form2 from a Click Event? or similar.
Public Class Form1<br />
<br />
...<br />
<br />
Private Sub Button1_Click(...)...<br />
<br />
Dim dt As New DataTable<br />
dt.Columns.Add("Name")<br />
dt.Columns.Add("Age")<br />
<br />
With DataGridView1<br />
For Each dr As DataGridViewRow In .Rows<br />
Dim obj() As Object = {dr.Cells("Name").Value, dr.Cells("Age").Value} ' EDIT Dim obj() As Object = ...<br />
dt.Rows.Add(obj)<br />
Next<br />
End With<br />
<br />
Dim frm As New Form2<br />
frm.DataGridView2.DataSource = dt<br />
<br />
frm.Show()<br />
<br />
End Sub<br />
<br />
...<br />
<br />
End Class
Does that make it clearer?
[EDIT: Dim obj() as Object = ...]
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
modified on Sunday, September 20, 2009 6:46 AM
|
|
|
|
|
It is throwing Error :
Error: Name 'obj' is not declared.
How to fix this?
|
|
|
|
|
Hi Andy,
I have already created columns in Datagridview2, these are "Name" and "Age".
I have filtered the Datagridview1 and Add those filtered rows in "Name" and "Age" of Datagridview2.
I am trying to understand Your code but not able to copy those filtered rows in Datagridview2.
Kindly help.
|
|
|
|
|