|
Go to datagrids property bulider page and set the column header there
Cheers
Navaneeth!!
|
|
|
|
|
well but doing so disturbs the order of binding source columns...lets say i have 3 fields id firstName n lastName and my colum names "ID", "First Name" n "Last Name". After binding it assigns field without any order against ID it binds fiestName field so on n so forth.
|
|
|
|
|
hello every one,
I am unable to close the form on the click event and load event of the form .
please help me:
1) How to close form on click event and load event in c#.
2) How to close the instance of an form in c#
rahul saini
|
|
|
|
|
this.Close();
either this or I don't get your question.
also you can manualy override
protected override void OnClosing(CancelEventArgs e)
{}
method if needed (like if you want user to confirm closing or fire up another method).
|
|
|
|
|
hi
thanks for showing interest
yes i have used
this.close();
but it is closing whole project
i want dat after login
the login window should be closed and mdi form should be opened.
but if me using this.close the whole project is closed
i hav seen an example in which they used
frmXYZ.instance().close();
but i my project their is no instance property for form.
me not understanding wat to do
please help.
rahul saini
|
|
|
|
|
There is some code that opens a window which don't close on parents form close event. Also there is delegate, you could do without it ofc.
public partial class Form4Skaitymas : Form
{
Form4Skaitymas_DataSheet form4ska_dat = new Form4Skaitymas_DataSheet();
public delegate void PassData(string uzs_mod, int uzs_nr, string darbID);
private void Some_method_of_yours()
{
PassData PD = new PassData(form4ska_dat.showData);
PD(mod_nr, part_nr, textBox3.Text);
form4ska_dat.Show();
}
}
// note: I removed most of the code form it and left only the imortant parts, as an example.
|
|
|
|
|
Hi all:
please help me to find a way to kill the processes that appear in the Task Manager from the Code?
I'm using Management Class to view the processes but i need a way to kill each of them.
Thanks
Regards
TaRiQ
|
|
|
|
|
using System.Diagnostics;
Process[] proc = Process.GetProcessesByName("process_friendly_name");
foreach (Process pt in proc)
{
pr.Kill();
}
|
|
|
|
|
Thanks man I appreciate that alot
TaRiQ
|
|
|
|
|
Hello,
The answere you got was correct!
But don't forget to dispose the processes.
pr.Dispose();//in your case
All the best,
Martin
|
|
|
|
|
YEP it's correct..
Thanks alot again
TaRiQ
|
|
|
|
|
Hi,
when reading a number in a TextBox with VB.NET i use:
Number = Val(TextBox1.Text).
How can this be done in C#
Thanks for any answer
JF2015
|
|
|
|
|
int myNumber = int.Parse(TextBox1.Text);
or
double myNumber = double.Parse(TextBox1.Text);
Just choose the right data type (int, float, double, ...). Then using method Parse.
|
|
|
|
|
Plz give me supar fast method for reading Large Xml File of 4MB to 10MB. i have used the following code but it is also slow for my Application.
1 st way->
FileStream sr=new FileStream ("C:\test.Xml",FileMode.Open);
XmlTextRader rd=new XmlTextReader(sr);
Whlie(rd.Read())
{
//
-----
//
}
Second way->
FileInfo sr=new FileInfo ("C:\Test.Xml");
XmlTextRader rd=new XmlTextReader(sr.OpenRead());
Whlie(rd.Read())
{
//
-----
//
}
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
How about :
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"C:\Test.Xml");
|
|
|
|
|
That is not faster at all.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Well the super-fast method would be read them same way as plain text. Maybe XML is not good format for your application? If you want to, provide more details about that XML file and app...
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hello everyone,
I am trying to create a media player. Right now I would like to add a control panel with images representing "Play", "Pause", "Stop", etc. I am not sure what is the right way to go about this. I tried a "menuStrip" which was dokced to the button of my winform but that doesn't seem right.
I have come across "User Control" and I was wondering if this is the right way to get this done.
truly appriciate your help in this issue. Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Hi i have a form1 that allows user to search for words.
Then i have another form2 that is for displaying the results, taking into consideration the parameters from form1.
However i have errors telling me that the richTextBox1 that i'm using it in form2 is inaccessible due to its protection level.
Error 1 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 126 32 LookUpShakespeare
Error 2 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 127 32 LookUpShakespeare
Error 3 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 135 40 LookUpShakespeare
Error 4 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 136 40 LookUpShakespeare
Error 5 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 137 40 LookUpShakespeare
Error 6 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 138 40 LookUpShakespeare
Can anyone help me to solve this?
FORM1
using LookUpShakespeare.GoogleSvc;<br />
<br />
namespace LookUpShakespeare<br />
{<br />
public partial class Form2 : Form<br />
{<br />
public Form2()<br />
{<br />
InitializeComponent();<br />
}<br />
public TextBox t1 = new TextBox();<br />
public TextBox t2 = new TextBox();<br />
<br />
private void btnGenerate_Click(object sender, EventArgs e)<br />
{<br />
String buildTerm = "";<br />
if (radioButton5.Checked == true)<br />
buildTerm = word.Text;<br />
else<br />
buildTerm = "\"" + word.Text + "\"";<br />
<br />
if (radioButton2.Checked == true)<br />
buildTerm = "-" + buildTerm;<br />
<br />
if (txtSearchString.Text != "")<br />
if (radioButton4.Checked == true)<br />
buildTerm = " OR " + buildTerm;<br />
else<br />
buildTerm = " " + buildTerm;<br />
<br />
if (checkBox3.Checked == true)<br />
{<br />
<br />
t1.Text = "true";<br />
}<br />
else<br />
{<br />
t1.Text = "false";<br />
}<br />
<br />
if (checkBox4.Checked == true)<br />
{<br />
<br />
t2.Text = "true";<br />
}<br />
else<br />
{<br />
t2.Text = "false";<br />
}<br />
<br />
if (comboBox1.Text != "")<br />
{<br />
comboBox1.Text = comboBox1.SelectedItem.ToString();<br />
}<br />
else<br />
{<br />
comboBox1.Text = "English";<br />
}<br />
<br />
if (word.Text != "")<br />
{<br />
txtSearchString.Text += buildTerm;<br />
buildTerm = "";<br />
word.Text = "";<br />
groupBox3.Enabled = true;<br />
} <br />
}<br />
<br />
public int beginResultPage = 0;<br />
public string q, combo;<br />
public Boolean f, s;<br />
<br />
private void btnSearch_Click(object sender, EventArgs e)<br />
{<br />
GoogleSearchService gsearch = new GoogleSearchService(); <br />
GoogleSearchResult gresult = new GoogleSearchResult();<br />
try<br />
{<br />
q = this.txtSearchString.Text;<br />
f = Convert.ToBoolean(this.t1.Text);<br />
s = Convert.ToBoolean(this.t2.Text);<br />
combo = this.comboBox1.Text;<br />
showResults(this.beginResultPage, this.key.Text, q, f, s, combo);<br />
<br />
}<br />
catch (System.Web.Services.Protocols.SoapException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
private void showResults(int beginResultPage, string key, string q, Boolean f, Boolean s, string combo)<br />
{<br />
GoogleSearchService gsearch = new GoogleSearchService();<br />
GoogleSearchResult gresult = new GoogleSearchResult();<br />
try<br />
{<br />
gresult = gsearch.doGoogleSearch(key, q, beginResultPage, 10, f, "", s, combo, "", "");<br />
Form4 ResultForm = new Form4();<br />
ResultForm.SearchForm = this;<br />
ResultForm.Text = "Estimated Result Count: " + gresult.estimatedTotalResultsCount.ToString();<br />
int j = gresult.resultElements.Length;<br />
ResultForm.elementCount = j;<br />
if (j == 0)<br />
<pre>{<br />
ResultForm.<big>richTextBox1</big>.Text += "Google Search results: " + "\r";<br />
ResultForm.<big>richTextBox1</big>.Text += "Sorry, no search results to display!";<br />
}</pre> else<br />
{<br />
for (int i = 0; i < j; i++)<br />
{<br />
if (gresult.resultElements[i] != null)<br />
<pre>{<br />
ResultForm.<big>richTextBox1</big>.Text += "Return Result # " + (beginResultPage + i + 1).ToString() + "\r";<br />
ResultForm.<big>richTextBox1</big>.Text += gresult.resultElements[i].title + "\r";<br />
ResultForm.<big>richTextBox1</big>.Text += gresult.resultElements[i].snippet + "\r";<br />
ResultForm.<big>richTextBox1</big>.Text += gresult.resultElements[i].URL + "\r\r";<br />
}</pre> }<br />
}<br />
ResultForm.Show();<br />
}<br />
catch (System.Web.Services.Protocols.SoapException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
}<br />
}
FORM2
using LookUpShakespeare.GoogleSvc;<br />
<br />
namespace LookUpShakespeare<br />
{<br />
public partial class Form4 : Form<br />
{<br />
public Form4()<br />
{<br />
InitializeComponent();<br />
}<br />
public Form2 SearchForm;<br />
public int elementCount = 0;<br />
<br />
<br />
<br />
}<br />
}
Regards, frossie
|
|
|
|
|
Why not simply using delegates?
|
|
|
|
|
I'm having difficulty adding hidden text to a RichTextBox. See case2 below.
Case1:
Initialize Form1 in Main(string[] args){}.
In Form1, initialize a RichTextBox as follows:
RichTextBox rtb = new RichTextBox();
Observe that rtb.SelectedRtf is initially set to "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033\\uc1 }\r\n";
Now try:
rtb.SelectedRtf = @"{\rtf1\ansi " + "visibleText" + @"\v " + "hiddenText" + @"\v0}";
result:
rtb.Text = "visibleTexthiddenText" as expected.
Case2:
Form1 is initialized as an MDIChild Form:
Again in Form1, initialize a RichTextBox as follows:
RichTextBox rtb = new RichTextBox();
This time rtb.SelectedRtf is initially set to empty string.
Try:
rtb.SelectedRtf = @"{\rtf1\ansi " + "visibleText" + @"\v " + "hiddenText" + @"\v0}";
result:
rtb.Text = "visibleText"
i.e. the hidden text is not being updated when Form1 is an MDIChild.
Anyone know the cause/walkaround? Your help is appreciated.
Thanks, B
|
|
|
|
|
I am facing the same issue. Its been 5 years since you have asked this question. Did you get the solution ? If so, please share with me.
|
|
|
|
|
As I recall an external component was loading a different version of the riched32.dll/riched20dll. Workaround was to initialize the right dll first (new RichTextBox() in your application).
Hope this helps.
|
|
|
|
|
Thank you very much for responding. I will give a try. Thanks again !
|
|
|
|
|
Hello,
I have an application names "Control Center". In this application i have implemented
Socket Server. I starts any number of .exe of my other application through process start.
And in that application i have implemented Socket client.
Now, i want suggestion that,
1.Is it good to communicate clients and server on single port?.
2. Is it harmfull to keep socket connection open continuously?.
3.If, i keep socket connection open continuously will it work properly?.
Please guide me.
Thanks In Advance.
Rahul Kulkarni
|
|
|
|