|
Can you not set the ScrollBars property to either Horizontal , Vertical or Both .
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,
the requirement for this functionality, the scrollbars must be set to "None".
thanks anyway
|
|
|
|
|
The only method I can think of would only give an approximation, so for what it is worth.
The VisualTextRenderer class has a GetTextMetrics method. The structure returned contains details such as FontHeight , AverageCharWidth , MaxCharWidth etc. for the Font and Graphics it is given.
You could divide the height of the TextBox by the FontHeight to give the number of lines. Then use either Average or Max Width to calculate how many characters fit on a line.
I have no idea how accurate this would be though.
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,can someone help me with this....
i want to know how to get the file name currently being modified/openned by certain process, i know about FileSystemWatcher tool but i want to get it in another way(i mean what process x is openning or modifying at a specific moment).
is there any API or c# code to it???
any help is appreciated
|
|
|
|
|
lost_in_code wrote: i want to know how to get the file name currently being modified/openned by certain proc
Unless the process exposes some kind of ommunication mechanism, there's no way to tell.
lost_in_code wrote: i know about FileSystemWatcher tool
The FSW won't work for you anyway since it can't tell that a file was opened at all. All it can see is the changes in the files timestamp attributes, which don't change if you open a file for read access.
lost_in_code wrote: i want to get it in another way(i mean what process x is openning or modifying at a specific moment).
The only way I can think of would be to enumerate all the process handles, and all of the file handles in the system and start trying to match them up with each other. But, there is no way to tell an .EXE file from a .DLL file from a .TXT file from a .DOC file, or any other file type. On top of that, most apps out there don't hold files open when they load them, so there's no file handle to try and match up anyway.
The bottom line is what you want to do is extremely difficult and unreliable.
|
|
|
|
|
with due respect
regardds to all the lover and users of c # dear i am new learner of c# and i have two problums
1. i want to convert the numeric value of text
eg when i enter 100 so it should converted to one hundred
eg i enter in one text box 123 in the other text box should come one hundred and twenty three
2. i want to calculate the value of two text boxes and minusing from thrid and showing in the another text boxes
not on button click but on the text box events (onchange or any one)but it should be textbox event thank you
|
|
|
|
|
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.
|
|
|
|