|
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
|
|
|
|
|
hi all
my requirement is like this on updation of table on the webserver an event should rise and let someone on the server should knwo that.....
i want a good site where i can get info. relating this or any suggestions how to do this....
how can i catcht the event tat is rised in sql server .... in vs 2005
thank you in advance
byebye
|
|
|
|
|
If you perform an update, you can catch this with a trigger. How you want to proceed beyond this, is entirely up to you, but I would start with defining a trigger.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I want to know how to reduce the color depth of a Bit Map Image in c#.
Then the resolution will be less at the same time the capacity of the image also will be reduced.
Then it is easy to send the image throght network due to the low capacity.
Hope thee will be some one who can give me a clue.
Thank You
NRKumudunee
|
|
|
|
|
Hi, I have a web method that is very chatty, here is sample output from it;
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<types:MyWebMethodResponse>
<MyWebMethodResult href="#id1"/>
</types:MyWebMethodResponse>
<soapenc:Array soapenc:arrayType="types:MyType[1]" id="id1">
<Item href="#id2"/>
</soapenc:Array>
<types:MyType id="id2" xsi:type="types:MyType">
<Id xsi:type="xsd:string">someid</Id>
<Number xsi:type="xsd:string">Number 1</Number>
<Title xsi:type="xsd:string">Title</Title>
<Addr xsi:type="xsd:string">some address</Addr>
<City xsi:type="xsd:string">some city</City>
<State xsi:type="xsd:string">some state</State>
<Zip xsi:type="xsd:string">11111</Zip>
<Times href="#id3"/>
</types:MyType>
<soapenc:Array soapenc:arrayType="types:Time[256]" id="id3">
<Item href="#id5"/>
<Item href="#id6"/>
<Item href="#id7"/>
<Item href="#id8"/>
<Item href="#id9"/>
...
<Item href="#id258"/>
<Item href="#id259"/>
<Item href="#id260"/>
</soapenc:Array>
<types:Time id="id5" xsi:type="types:Time">
<StartTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</StartTime>
<EndTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</EndTime>
</types:Time>
<types:Time id="id260" xsi:type="types:Time">
<StartTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</StartTime>
<EndTime xsi:type="xsd:dateTime">2007-01-29T13:18:00.0000000-08:00</EndTime>
</types:Time>
</soap:Body>
</soap:Envelope>
All of those <Item href...> take up a lot of space, is there a way instruct .net not generate it?
This is the declaration over the webservice C# class file;
[WebService(Namespace=Constants.NAMESPACE), ToolboxItem(false), SoapRpcService]
The web method just has plain, [WebMethod] attribute and that's it.
Thanks,
|
|
|
|