Thanks for your advice. I appreciate the time you took to write such a detailed response. I have actually gone back over some of the chapters and have a much better understanding. Your advice is solid.
Printable View
Thanks for your advice. I appreciate the time you took to write such a detailed response. I have actually gone back over some of the chapters and have a much better understanding. Your advice is solid.
You are very welcome (see the people here are really willing to help those who show just a little effort :) )
Also remember to rate those posts you find helpful.
If you have any further questions, please start a new thread. :wave: :wave:
They were rated right after my reply:). I could tell people are willing to help here. I would have given up long before you guys did and I am very patient. I most certaily will be using this site from now on.
great :) And - You are welcome :wave:Quote:
Originally Posted by ddjammin
hi again everyone... i am very sorry for arrogance, ignorance and lack of knowledge. I Really didn't mean to get this forum ticked off.
You got my question answered JonnyPoet and i am very grateful. Thanks a lot.
by the way, all the code you guys see thats not used in my program is because i am in the learning phase, and i am changing the code of the whole program over and over again trying to make it feel better. The testwindow class, i decided to put it in the onclick event.
thanks and sorry againCode:void run_click(object sender, EventArgs run_click)
{
string tempFile = Path.GetFullPath("C:/csc/");
string file = tempFile + "temp" + ".html";
Uri dir = new Uri(file);
SW = File.CreateText(file);
SW.Write(txtbox1.Text);
Form test = new Form();
test.Text = "Testrun";
test.Width = 640;
test.Height = 480;
WebBrowser wb = new WebBrowser();
wb.Parent = test;
wb.Dock = DockStyle.Fill;
wb.Url = new Uri("C:/csc/temp.html", System.UriKind.Absolute);
wb.CreateGraphics();
test.Show();
SW.Close();
wb.Update();
}
DahWan (not dahwai :P)
My program is starting to work quite well!
One problem i still have is that when i "run" the file, i have to update(F5) to display what I've done. How can i do that automatically?
wb.Update() didn't work...
I figured it out, no problem ^^
I told you you have to close the writer stream just after finishing the writing and not in the end of the function. Otherwise its qwaiting for additional writings and not writing back all the data to the harddisk. Its absolutly necessary to close the stream, so it writes back all the data and finishes this, otherwise reading before closing the stream will lead to an empty html.Quote:
Originally Posted by dahwan
See the blue written code in post#112 line 9 text: SW.Close();
Blue written I 'm everytime suggesting people to add code red written lines suggest to be wrong and needs to be deleted.
In your code wb.Update() cannot work as the stream which is read is empty if you havn't closed the write procedure.
Code:// your code ...
// here you access the html for reading the data but the writing stream is open so your html file is empty
wb.Url = new Uri("C:/csc/temp.html", System.UriKind.Absolute);
wb.CreateGraphics();
// here you show the empty html in your browser
test.Show();
// now you close the writer and the html file on Harddisk is finished
SW.Close();
// but the data you have read to your browser are still that of the empty file from before
// now you rewrite this date ( which are empty ) again to the webbrowser, so nothing changes.
wb.Update();
I know, i figured it out...
Anyway, more progress, more problems. When i click ctrl+t to add a title tag, the tag ends up in the end of the text, where ever my pointer is.
How do i add the tags where my pointer is? And if possible, how do i put the pointer in between the tags?
This depends on your code as you didQuote:
Originally Posted by dahwan
Its obviously that you are adding this to the end of your richtextboxes text. So dont wonder:pCode://INSERT <TITLE></TITLE>
if (kea.KeyCode == Keys.T && kea.Modifiers == Keys.Control)
{
txtbox1.Text += "<title></title>";
}
And here is what you need to doAnd look for similar errors in other parts of your codeCode://INSERT <TITLE></TITLE>
if (kea.KeyCode == Keys.T && kea.Modifiers == Keys.Control)
{
//txtbox1.Text += "<title></title>"; delete this
// get actual position of the caret
int CaretPosition = txtbox1.SelectionStart;
// devide the text in the text before and the text after caret.
string sTxt1 = txtbox1.Text.Substring(0,CaretPosition);
string sTxt2 = txtbox1.Text.Substring(CaretPosition);
// insert the needed tag between the two parts and write all back to rtb
txtbox1.Text = sTxt1 + "<title></title>" + sTxt2;
}
Of course, that code makes so much sense XD
thanks a lot!
Oh my word!!! Suddenly everything is so easy!!! Not only do i add the tags, but also do i put the selection between the tags! This is so much fun ^^
thx a lot, poet!!
Sounds as if you have had a big win, getting rid of some 'big mysteries' simple named 'misunderstoods' :D :lol: :DQuote:
Originally Posted by dahwan
Enjoy and - go on to be interested in learning - instead of being a 'know best' boy ;) :wave:
I'm a bit offended, but so what? I'm so happy!!! :D
?? who is offending you. Its only a note for you to change your mind and don't falling back to former habits.
And again: If we need to read your code then it needs to be done in a standard way. If you really dont understand why this is necessary, thenI ask you why you dont write your posts in norway language ? Because nobody would read it, its too difficult first to translate your text to english, then reading it, then answering. So this is obviously clear for you.
And this is the same 'why' , why we need a standard way of writing code. Nothing against to have order in your class. Easy to do For example you can order them into Properties, methods and Events using regions. This way you have a nice order on a form and clicking to the specific region it opend and closes.
Try this instead of unusual cutting your classes into parts.Code:#region myEvents
.... all your events code
#endregion
BTW: All your code has no correct dispose Methods. Again look into what the wizzard does, when creating a project to see what parts are necessary to have a correct working code.
Also think: Bas Habits in coding are easily trained but nearly impossible to correct, when you have trained yourself this way.