|
|
Hi,
How can I print to debug window from a C# Web Service?
Thanks!
|
|
|
|
|
Hello There My Article Updated I soluted Soruce code Problem
Ahmed Erarslan
MCAD,MCDBA,MCP
MCSD.NET
|
|
|
|
|
Ahmed, perhaps a link to your article would be helpful, along with a description of your article.
Also, the C# forum is not the best location to post this.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
You call that updated? You still aren't explaining anything your code is doing or why. It's still just a bunch of barely related code snippets, nothing more.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Guys, Gals
I can't find any info on how to search a treeView, basically I'm dreaming big and would like to find a way that as a user types in the textbox the search method scrolls thru the treeView to find the matching string of text... ie like you see in a windows help search.
any ideas,
|
|
|
|
|
Use a recursive function or a while loop to search through all the nodes in a treeview. When you find a matching TreeNode, call EnsureVisible() or some other function to make the treeview scroll down to it.
FindMatchingNode("http://judahgabriel.blogspot.com", this.treeView1.Nodes);
void FindMatchingNode(string text, TreeNodeCollection nodes)
{
foreach(TreeNode node in nodes)
{
if(node.Text.IndexOf(text) != -1)
{
node.EnsureVisible();
break;
}
else FindMatchingNode(text, node.Nodes);
}
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Cool, Much thanks
but....
i can't seem to get it to highlight the node once it finds it....
???
|
|
|
|
|
Try setting the SelectedNode to the node you want selected. Also note that if you have HideSelection set to true that it won't show the selection if the tree doesn't have focus.
--
Joel Lucsy
|
|
|
|
|
Can Some help me to make a textbox in which user can type only numerical or Uppercase charecters ?
|
|
|
|
|
|
Itis bretty easy just override the OnTextChanged event and check the new char if it is a number or uppercase,you can know about numbers by putting them in an array,or just trying double.TryParse() function,in a try-catch block;
|
|
|
|
|
Capture the KeyPress Event of TextBox
The following is for numeric. Add condition for Upper Case.
private void TextBoxInceptionANAKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
try
{
//Handle only if the value being entered is NUMERIC
if (e.KeyChar >= (char) 48 && e.KeyChar <= (char) 57 )
{
e.Handled = false;
}
else
{
//Sound beep
MutualFundHelper.SoundBeep();
e.Handled = true;
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
|
|
|
|
|
Hello,
I have dynamically allocated menu items, and for eahc of these menus I have submenus.
foreach (object i in versionsAnddates) {
string[] splitStr = Convert.ToString(i).Split('~');
SubMenu = new MenuItem ();
SubMenu.Text = "Version: "+splitStr[0]+" --- "+splitStr[1];
this.projectsMenu.MenuItems.AddRange (new MenuItem[] {this.SubMenu});
this.projectsSubMenu.Click += new System.EventHandler(this.Version_Click);
}
How can I pass some of the parameters (some string for example) to the Version_Click event when menu item is clicked?
Thank you
|
|
|
|
|
In those situations I prefer inheriting my own class from MenuItem e.g.:
private class MyMenuItem : MenuItem
{
private string _version;
public MyMenuItem(string version) : base()
{
_version = version;
string[] splitStr = Convert.ToString(_version).Split('~');
base.Text = "Version: "+splitStr[0]+" --- "+splitStr[1];
}
public string Version
{
get { return _version; }
}
}
Your code would then look like:
foreach (object i in versionsAnddates) {
SubMenu = new MyMenuItem (Convert.ToString(i));
this.projectsMenu.MenuItems.AddRange (new MenuItem[] {this.SubMenu});
this.projectsSubMenu.Click += new System.EventHandler(this.Version_Click);
}
and the event handler...
private void Version_Click(object sender, EventArgs e)
{
MyMenuItem mmi = sender as MyMenuItem;
if (mmi != null)
{
Console.WriteLine(mmi.Version);
}
}
|
|
|
|
|
Thank you so much,
It was a perfect solution.
Thank you again
|
|
|
|
|
Hi everyone,
It is said that using Xml Document to store application settings is better than store settings in an Ini file or Windows Registry, so I'd like to try this new way of storing settings. But I don't know how to Read/Write settings form/to an Xml Doucment. Who can give me a sample code(s) or E-mail these codes to me?
For example, in an Ini file:
[UserInfo]
FirstName=Cheng
LastName=Zhong
Age=19
[Window]
X=120
Y=345
Width=320
Height=240
Font.FamilyName=Arial
Font.Size=8
Font.Bold=True
Font.CharSet=936
How can I write the settings above to an Xml file(not convert it to Xml)?
And how can I load the settings like "Age" from an Xml file?
And how can I get the list of "Sections" or "Keywords"(maybe it is called
"Attributes" or "Nodes" in Xml)?
Both VB.Net Codes or C# Codes are OK. Thank you!
More, do you have some advice to store none-string-type settings and none-integer-type settings, like Color(System.Drawing.Color), Font (System.Drawing.Font), Handle(System.IntPtr), Array(System.Array)?
E-mail: zc_djx@hotmail.com
I'm learning VB.Net & C#, you are always welcome to help me!
|
|
|
|
|
Zhong Cheng wrote:
Who can give me a sample code(s) or E-mail these codes to me?
noway. There is lot of samples on the web...
Zhong Cheng wrote:
How can I write the settings above to an Xml file(not convert it to Xml)?
It's called XML file because it contains data in XML. Why would you want not to convert it into XML??
Please read about .NET Configuration files[^]. This is what is in 99% meant as configuration in XML, standardized API and format, most of work is already done in .NET framework - most of answers to your questions are there. For the rest, you can ask here again.
Zhong Cheng wrote:
I'm learning VB.Net & C#, you are always welcome to help me!
Start with a good book or/and http://msdn.microsoft.com/[^]
David
|
|
|
|
|
dnh wrote:
It's called XML file because it contains data in XML. Why would you want not to convert it into XML??
It is not difficult to rewrite data/settings in Ini file to an XML file.
E-mail: zc_djx@hotmail.com
I'm learning VB.Net & C#, you are always welcome to help me!
|
|
|
|
|
In addition to what dnh said, look at the System.Xml.Serialization.XmlSerializer object. It can convert an entire class to and from and XML file.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Hi
i work with System.Drawing.Graphic class . i want to save the variable to an image object and then restore the image to variable of graphic class .
and another question :
how can get the color of pixel in form ? have i must use the graphic class ?
2-when i draw a line in form and minimize the form after resoring form line is cleared . what i must do to save the contant of form ?
Regards Amir Jalaly
|
|
|
|
|
Amir Jalaly wrote:
i want to save the variable to an image object and then restore the image to variable of graphic class
WHAT?? This makes no sense what-so-ever. The Graphics class doesn't represent an image of anything. Perhaps a better explanation of what you want to accomplish would help.
Amir Jalaly wrote:
when i draw a line in form and minimize the form after resoring form line is cleared .
All your drawing on the form surface must be done in the Form's OnPaint event. You have to repaint your graphic items every time the form is redrawn, which happens quite frequently.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi dear me too is working on these images and graphics
ans: Q2:- Register the event handler of OnPaint
to save the color of pixel use Getpixel(), it returns a Color object u can use it later.
Graphics class surely helps.
Abt Q1 i can't understand what have u asked plz ellaborate it
|
|
|
|
|
HI
Thanks for your answer .
i don't understand how i must use GetPixel . is that a func of graphic class ?
Can you help me more ?
Also i want to fill a area that i draw in my form . can help me plz ?
Regards Amir Jalaly
|
|
|
|