|
Hi,
welcome to CodeProject
1.
there are over 20000 articles here; at least one of them deals with Number To Text Converter[^]
2.
TextBox events are explained in the documentation. Use Google to locate them.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thanks dear
you have givent the links you have given me the code of cpp i really thanks again
bye
|
|
|
|
|
Hello,
I have a string variable in Form1. I receive the string from a datagrid
I want to pass it to form2 and use it there as a query to another datagrid in this form. How can i do it? I mean the passing of the variable itself?
|
|
|
|
|
Have a public property in Form2
public string QueryString
{
get; set;
}
Then when you create an instance of Form2
Form2 queryForm = new Form2();
queryForm.QueryString = "this is the string";
queryForm.ShowDialog();
then in queryForm the string is available to do whatever you want with.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ok.
And do i need to add new windows form or new iherited form (i mean in add new item window in visual studio)?
|
|
|
|
|
You said that you have a form1 and a form2. Why would you need to add another form? Where I have used queryForm just use your existing form.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yes.
But i haven't add form2 yet. So how do i need to add him (as new window form or inheirted form- How can i know it?)?
|
|
|
|
|
michaelgr1 wrote: So how do i need to add him
Same as you would any other form.
michaelgr1 wrote: as new window form or inheirted form- How can i know it?)?
I've no idea what you mean by any of that.
What do you mean by "window form" and "inherited form"?
There is a Form class, when ever you create a form you inherit from it. That's it. End of story. So, I don't understand where you are seeing a distinction.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
When i do the get, set i receive an error says:
"'Focus_Report.Form2.QueryString.get' must declare a body because it is not marked abstract or extern"
"'Focus_Report.Form2.QueryString.set' must declare a body because it is not marked abstract or extern"
What do i need to write there to make it work?
|
|
|
|
|
You need to provide body for get and set . Something like
public string QueryString
{
get
{
.....
}
set
{
.....
}
}
|
|
|
|
|
What version of C#/Visual Studio are you using?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I use visual studio 2005.
How do i know what i need to write in GET and SET body?
|
|
|
|
|
OK.
I had assumed that you were using 2008, my bad.
Change
public string QueryString
{
get; set;
}
to
private string queryString;
public string QueryString
{
get
{
return this.queryString;
}
set
{
this.queryString = value;
}
}
Then inside your form2 you can use the private queryString , and from outside form2 use the public QueryString .
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello,
What is the difference in declarations in Visual studio 2008 and 2005. Why it 2008 we don't have to write this code?
BTW, I wrote only:
public string QueryString;
Is it enough? or i still need the constructor and why?
Sorry about the bothering and thanks again very much for your help.
|
|
|
|
|
michaelgr1 wrote: What is the difference in declarations in Visual studio 2008 and 2005. Why it 2008 we don't have to write this code?
In Visual Studio 2008, for simple properties you only have to write it as I showed the first time, VS does everything else to make it behave like the second example I gave, behind the scenes. In VS2008 they are called Auto-Implemented Properties.
michaelgr1 wrote: BTW, I wrote only:
public string QueryString;
Is it enough? or i still need the constructor and why?
What you have done, should work. BUT it is considered to be bad programming in OOP (Object Oriented Programming, just in case you didn't know). It breaks several of the 'rules', most notably the Data Hiding principle. Google on that for a more detailed explanation.
For now, though, consider the case that you wanted something to happen automatically every time QueryString changed. With your method it will be very, very difficult. With the second method I posted it would be very easy, and what's more it would be less likely to break some other part of the code.
Like this:
private string queryString;
public string QueryString
{
get
{
return this.queryString;
}
set
{
this.queryString = value;
this.MyDoSomethingWonderfulWithQueryStringMethod();
}
}
If you later had to change the way that MyDoSomethingWonderfulWithQueryStringMethod() works, you can, and as I said it is unlikely to break anything else.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi
in my windows application i have two forms one contains gridview, dataset and binding source. the other form has textbox,combobox and a button.
if i click the button present in second form the datas present in textbox shld be update with the combobox...the update result shld be present in grid view...
i have written the code but its not working
here is the code
private void botton_click()
{
SqlConnection con=new SqlConection)("severname=dot ;database=data;uid=123;pass=sdf;")
SqlCommand cmd=new SqlCommand("update tablename set Textbox='"+textBox1.Text+"' where Combo='"+ComboBox1.SelectedItem+"',con")
cmd.ExecuteNonQurey();
con.Close
}
the above code is running but its not updating the gridview
Please give me some ideas
thanking you
|
|
|
|
|
Your gridview does not know of the update as long as you don't tell it you have done an update.
You should requery your database for the new data
Do Or Don't, there is no "try catch ex as exception end try"
|
|
|
|
|
Hi,
i need to print a document in my c# application, this document has some utf8 characters because it is in persian language (these characters also can be found in arabic), but when i use printdocument and printdialog components the printed page is full of nonsense characters, i think it must be about the language and i tried to google it but i couldn't find another component in net, can anybody please help me???
Roshanakak
|
|
|
|
|
hi roshanak, this problem is quite common between HP printer's, if thats the case u can get support from HP official site. if that couldn't help u, the only way is storing the graphics in a bitmap and then print the bitmap like this:
private void printDocument_printPage(object sender, PrintEventArgs e)
{
Bitmap bmpPrint = new Bitmap(1000,1000);
Graphics g = Graphics.FromImage(bmpPrint);
/*
Draw what u need using "g".
*/
e.Graphics.drawImage(bmpPrint);
}
the quality is not as good as is should be, unless u change the printing resolution.
|
|
|
|
|
The question is not so much "how to do it" but more "which way is best"
And there are several ways, such as:
* divide by 1024 and keep (a bit of) the fractional part (what is this even good for? just say it in bytes then)
* divide by 1024 and truncate (number of whole KB's)
* divide by 1024 and round (nearest to actual size)
* divide by 1024 and round up (to avoid underestimating the size)
Either there is no standard set for this, or Microsoft ignores it. For example, MSN and Explorer often do not agree on the size of a file, in MSN it would appear to be 1kb smaller. Sounds exactly like a rounding error difference to me.
Which way would you prefer and why?
|
|
|
|
|
Hard drives use 1000 instead of 1024, just to make it worse.
I would truncate.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote:
Hard drives use 1000 instead of 1024, just to make it worse.
And ISPs also.
I suspect they do that because it gives them a higher number..
|
|
|
|
|
Yeah, it's all marketting.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Don't expect MS to be consistent.
I have a single method that takes both the exact value and a minimum value, and returns a string expressing the size as an integer number in either giga/mega/kilo/byte making sure the number is greater/equal the minimum value. So calling it with (10240, 11) would return "10240", whereas calling it with (10240, 9) would return "10K"
I round up, i.e. add 1023 and divide by 1024.
That way a 10K file fits in a 10K space (well, that is hoping space never gets rounded up).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
CG didn't really provide a reason why to truncate, so rounding up wins (so far)
|
|
|
|