|
|
Thanks so much. I will follow to the attached links and do more homework.
|
|
|
|
|
Hi again. I Talked to my friend. His intention in this part of the excersise was that I practice operator overloading and interface creating and implementation. I will try the CompareTo() way as well, but would appreciate very much if you could throw me a hint of the general structure of the other way.
Thanks,
Vered
modified on Monday, January 26, 2009 5:57 AM
|
|
|
|
|
A basic tutorial of operator overloading is in Operator Overloading Tutorial[^]. Note that many operators must be overloaded in 'pairs'. For example if you overload == operator you must overload != operator. The same goes with < and > operators.
What comes to interfaces, I think you could start here: Interfaces (C# Programming Guide)[^]
Hope they help you.
|
|
|
|
|
i want to convert a column look into table look.Can any body tel me how to do this?
e.g.datagridview having 2 columns
name address
arshadaslam pk
to look like
name address
first Last
arshad aslam pk
which now have three columns:first,last,address.
modified on Sunday, January 25, 2009 12:10 PM
|
|
|
|
|
Hi, I am trying to figure out insert text with different format(bold, regular, italic) into line. I am looking for whole weekend but no result. Plese help me. Thanx in Advance.
Here is my code:
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;
object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc";
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
Word.Paragraph oPara6;
oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara6 = oDoc.Content.Paragraphs.Add(ref oRng);
oPara6.Range.InsertAfter(" ahoja");
oPara6.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
oPara6.Range.Font.Size = 12;
oPara6.Format.SpaceAfter = 5;
oPara6.Range.Font.Bold = 1;
oPara6.Range.Text = "Vymezení jednotek v budovì";
oPara6.Range.InsertParagraphBefore();
oPara6.Range.InsertBefore("ahoja ");
oPara6.Range.InsertBefore("ahoja ");
oPara6.Range.InsertParagraphAfter();
oPara6.Range.InsertBefore("ahoja ");
oPara6.Range.InsertBefore("ahoja ");
oPara6.Range.FormattedText.End = 0;
oPara6.Range.FormattedText.Bold = 1;
oPara6.Range.Text = "Vymezení jednotek v budovì";
oPara6.Range.InsertAfter("ahoja ");
oPara6.Range.InsertBefore("ahoja ");
oPara6.Range.InsertParagraphBefore();
|
|
|
|
|
Hi! everyone,
Regular Expression sometimes match empty strings, can someone tell me why it happens and what is the use of matching empty strings(why have the original designers made it that way)? Here are some examples:
In these examples, the "Pattern" is the Pattern used for matching and the "MatchWith" is the string that is evaluated. The "Count" is the number of hits, and finally "Occurrences" lists all of them. Following is the output of a console application.
Pattern: \d*
MatchWith: 34544
String: 34544, Pattern: \d*, Match: |TRUE|
M String: 34544, Position: 0, Count: 2, S Length: 5
Occurences:
String: 34544, Length: 5, Position: 0, Success: True
String: , Length: 0, Position: 5, Success: True
-------------------------------------------------------
The above example matches an empty string, why?
Pattern: \d*
MatchWith: dfgdr
String: dfgdr, Pattern: \d*, Match: |TRUE|
M String: , Position: 0, Count: 6, S Length: 5
Occurences:
String: , Length: 0, Position: 0, Success: True
String: , Length: 0, Position: 1, Success: True
String: , Length: 0, Position: 2, Success: True
String: , Length: 0, Position: 3, Success: True
String: , Length: 0, Position: 4, Success: True
String: , Length: 0, Position: 5, Success: True
-------------------------------------------------------
The above example matches 6 empty strings, more than the actual length of the input string, why?
Following are examples of Lookahead:
Pattern: (?=.*\d)
MatchWith: 44
String: 44, Pattern: (?=.*\d), Match: |TRUE|
M String: , Position: 0, Count: 2, S Length: 2
Occurences:
String: , Length: 0, Position: 0, Success: True
String: , Length: 0, Position: 1, Success: True
-------------------------------------------------------
Above: again an empty string.
Pattern: (?=.*\d)
MatchWith: dfg
String: dfg, Pattern: (?=.*\d), Match: |FALSE|
M String: , Position: 0, Count: 0, S Length: 3
Occurences:
-------------------------------------------------------
Above: same failed with strings as input: "FALSE"
Pattern: (?=.*\d)
MatchWith: fgd3
String: fgd3, Pattern: (?=.*\d), Match: |TRUE|
M String: , Position: 0, Count: 4, S Length: 4
Occurences:
String: , Length: 0, Position: 0, Success: True
String: , Length: 0, Position: 1, Success: True
String: , Length: 0, Position: 2, Success: True
String: , Length: 0, Position: 3, Success: True
-------------------------------------------------------
Above: same pattern, but now matches of empty string
Thats all
Thanks
|
|
|
|
|
Because you have specified that it should allow a zero count. The * is the same as {0,} which specifies that the pattern should match zero or more times.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I m new in .net
wel i want to know the diff. between M.overloading & C.overloading
i think ,, we can use the method after cons.overloaded by only method overloading???
& mainly ,what is the need we use or prefer them,, ??
reply me in detail
kindly reply ,,
Regards waqar
|
|
|
|
|
Do you mean method overloading and constructor overloading?
They are much the same, except constructor overloading enables you to create your object instances from different signatures that cn be used for initialization. Method overloading enables different method implementations to be called depending on the signature.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi all,
the last operation of my program is to store the contents of a richtextbox to a file.
Often the contents of the file will be destroyed.
Saving by hand (button) never destroys the contents.
So it seems that the saving task (asynchronious ???) will be finished too soon at the end of my program.
I inserted a sleeptime to prevent the destruction an to give the savetask the time it needs but that's no solution steadily.
How can I detect, the end of the savetask of the richtextbox before finishing the program ?
tnx
Frank
|
|
|
|
|
Since the saving can be performed in numerous ways, it's impossible to pinpoint the problem without seeing the code. One reason could be that you don't close the stream, but as said, please post the code.
|
|
|
|
|
I am simply using the safefile method of the richtextbox control, that's all.
rtxt.SaveFile(Application.StartupPath + "\\log.rtf");
and rtxt is from type System.Windows.Forms.RichTextBox
I did'nt found a method for the RTB like .flush or .close to finish the stream securely.
tnx
|
|
|
|
|
Try this in your FormClosing event handler:
using (System.IO.Stream stream = new System.IO.FileStream(
Application.StartupPath + @"\log.rtf", System.IO.FileMode.Create))
{
rtxt.SaveFile(stream, RichTextBoxStreamType.RichText);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thank you,
that sounds good, I will try this.
tnx Frank
|
|
|
|
|
That should work fine but at which point are you calling this? Is the contents of rtxt possibly destroyed?
|
|
|
|
|
I call the method as last instruction in the method main[].
tnx frank
|
|
|
|
|
At that point you won't have anything to save. Use FormClosed event instead and save the contents of the control in that event.
|
|
|
|
|
Works fine for me. Where are you calling the SaveFile method from (which event - FormClosing?). Which overload of SaveFile are you using?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
i've bounded a TextBox, DateTimePicker and NumericUpDown to a database Via a BindingSource
the thing is that when i change one of the values nothing happens
here is the ButtonClickEvent that should Update the DB
private void button1_Click(object sender, EventArgs e)
{
t_AppTableAdapter.Update(dataSet2.T_App.Rows[0]);
dataSet2.AcceptChanges();
}
where do i go wrong??
Have Fun
Never forget it
|
|
|
|
|
First, set a breakpoint to
t_AppTableAdapter.Update(dataSet2.T_App.Rows[0]);
and check the RowStates and that they are Modified.
If the RowState isn't set, the problem is most likely in binding.
Also the Update method takes a datatable or a datarow array as a parameter. Now you pass only one row. If you want to update all the modifications in the datatable, call:
t_AppTableAdapter.Update(dataSet2.T_App);
|
|
|
|
|
Thanks ,
the DataRowState remains "unchanged"
do u know what could be the problem in the bindingsource???
Have Fun
Never forget it
|
|
|
|
|
First you could check that just after modifying a value in a control, the datatable contains the change (and the rowstate is Modified). If the modification is not reflected correctly to the datatable, your control binding isn't correctly.
If the modification is visible in the datatable, then I would suspect that you call either AcceptChanges or RejectChanges somewhere before you call the DataAdapter.Update.
Also it could be possible that you have binded a datatable to the controls, but you are actually trying to save a different datatable (a copy?).
|
|
|
|
|
|
Ok.
I'm a bit confused since in your earlier post you said that the rowstate was not modified before calling update? So are these correct observations:
- you change the data using a control
- immediately after that, your datatable contains a record with RowState = Modified
- when you come to the point where you call adapter's Update, your datatable doesn't have a record which is Modified?
Also remember that if your datatable contains more than one record, you originally updated only the row at index 0 (t_AppTableAdapter.Update(dataSet2.T_App.Rows[0]); ) maybe the record you modified using UI isn't that record. For that reason you should always call t_AppTableAdapter.Update(dataSet2.T_App);
When I wrote about the copy, I meant that is it possible that you actually have two different datatables. Changes are made to one datatable but update is called using another. But if you're sure that you have only one datatable, then this won't be an issue.
|
|
|
|
|