|
I find the easiest way to do this is to change the subform's constructor and pass the control or variable or even the parent form in that.
|
|
|
|
|
There would be no need to pass public variables or the parent form through the constructor, since the child form has access through this.Parent
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Hi. I'm having trouble using streamwriter on certain files because those files contain chinese characters. I can fix my problem, but only in a way that it'll work correctly for one or the other, but not both at the same time.
The main issue is that I need to write to files that do not contain chinese, and files that do contain chinese. These files are mixed together, and at times there can be 500+ files. The only way to tell them apart that I can think of is to check if the file uses a certain font.
The files that contain chinese characters display them using the SimSun font. The files that do not have chinese characters do not use the SimSun font.
How can I check a file to see if it uses a certain type of font? I just need pointed in the right direction. I've tried messing around with iTextSharp but it doesn't seem to be able to read files, just write to them.
|
|
|
|
|
Can't you check the encoding that the text file uses?
For example, Unicode(UTF-8) or Greek (ISO) or Arabic (DOS).
Or is the encoding all the same, and its just the font that provides the chinese characters?
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
I don't know how if it's possible.
All I could find on that was "EncodingInfo GetEncodings" or something, which I tried on a file containing chinese and a file that had just 1 character of english. They both returned about 30 codepages... all of which were exactly the same.
*shrug*
|
|
|
|
|
Hello everyone,
I have created a BHO using C#. The code works fine. I would like to detect mouse click on a particular bytton. The following is the SiteSet().
public class BHO : IObjectWithSite<br />
{<br />
private SHDocVw.WebBrowser webBrowser;<br />
private mshtml.HTMLDocument document;<br />
private mshtml.IHTMLDocument2 document2;<br />
private mshtml.HTMLElementEvents_Event events;<br />
<br />
public int SetSite(object site)<br />
{<br />
if (site != null)<br />
{<br />
webBrowser = (SHDocVw.WebBrowser)site;<br />
webBrowser.DocumentComplete += new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);<br />
webBrowser.BeforeNavigate2 += new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2);<br />
<br />
webBrowser.OnQuit += new SHDocVw.DWebBrowserEvents2_OnQuitEventHandler(this.OnQuit);<br />
webBrowser.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.NavigateComplete2); <br />
<br />
events.onclick += new mshtml.HTMLElementEvents_onclickEventHandler(this.OnElementMouseClick); <br />
<br />
}
for the OnElementMouseClick function I have the following.
public bool OnElementMouseClick()<br />
{<br />
MessageBox.Show("HelloWorld...");<br />
return true;<br />
}<br />
.<br />
.<br />
.<br />
.<br />
But nothing really happens! Am I wrong to think that the above code should give me HelloWorld message once a button is click?
Any information on this would be appriciated. Thank you very much.
Khoramdin
|
|
|
|
|
|
Hello,
You should POST the entire message rather than posting one section of it. If I remeber correctly, I said "If my messages bother you so much I surly can stop and take my postings and problems to another forum.". That is if you wish to be fare, mate!
I still stand by my posting as I am not here to upset anyone.
By the way, didn't take your advise and managed to solve the problem. Hey, not all of use get Free MVP title! *wink*
Thank you for the reply.
Khoramdin
|
|
|
|
|
Khoramdin wrote: You should POST the entire message
You mean like the like above the reference?
Khoramdin wrote: By the way, didn't take your advise and managed to solve the problem.
Good for you. It is helpful to others to post the solution. If indeed you have solved it yourself. Perhaps someone with more experience just finished it for you. "wink*
only two letters away from being an asset
|
|
|
|
|
ha ha ha...
I wish someone had solved it for me, mate! I truly cracked my head on that BHO and believe me when I tell you that I was so excited when it got working!
I cannot deny the fact that I read nearly a milliion posting and articles before I managed to get it up and running.
I am actually thinking of creating a STEP BY STEP and detailed tutorial and submit it to codeproject regarding the BHO. My finding was that, expect one or two articles; there isn't much of information on BHO on Internet.
It is good to see you have a delightful sense of humor. Happy thanx-giving, mate.
Khoramdin
|
|
|
|
|
how I can insert image into sqlserver database with c#.
|
|
|
|
|
how I can insert image into sqlserver database with c#.Ineed the code
|
|
|
|
|
|
Hello yemen_programmer,
As far as I know, there are TWO ways to do so.
1- To store only the location of the image into your database and the image file in a different folder.
2- To store the image file as a BLOB file.
The option 1 is stright forward as you only store a text into your database while your image sits in a folder. Therefore, I am going to leave that.
The second option can be done with a code similar to the one here. Keep in mind that this line of code uses MySQL database and the command line "INSERT INTO ....." may be different for SQL and you need to check that out. I personaly use MySQL. The following code also includes storing other information about the stored image. But the most important one that you require is ItemImage and ImgeSize.
OdbcCom = new System.Data.Odbc.OdbcCommand("INSERT INTO item VALUES (NULL, ?, ?, ?, ?);", OdbcCon);<br />
<br />
OdbcCom.Parameters.Add("@ItemName", System.Data.Odbc.OdbcType.VarChar);<br />
OdbcCom.Parameters["@ItemName"].Value = txtItemName.Text;<br />
<br />
OdbcCom.Parameters.Add("@ItemImage", System.Data.Odbc.OdbcType.Image);<br />
OdbcCom.Parameters["@ItemImage"].Value = ImageArray;<br />
<br />
OdbcCom.Parameters.Add("@ImageSize", System.Data.Odbc.OdbcType.Int);<br />
OdbcCom.Parameters["@ImageSize"].Value = FileSize;<br />
<br />
OdbcCom.Parameters.Add("@ItemInfo", System.Data.Odbc.OdbcType.VarChar);<br />
OdbcCom.Parameters["@ItemInfo"].Value = txtItemInfo.Text;<br />
<br />
OdbcCom.ExecuteNonQuery();
Keep in mind that before being able to do so, you need to place your image in an Array which in the above code is called ImageArray.
I hope that could help you out to get your image into your database.
Cheers,
Khoramdin
-- modified at 14:49 Wednesday 21st November, 2007
|
|
|
|
|
Hello, anyone know a way to create a shortcut in vista. I try the usual path to generate it in XP, but it's a permisson problem in vista that you've to put your exe with adm priv on the manifest. Any idea?
|
|
|
|
|
You have to download the file top open it.
Think about it for a moment, you have your temporary internet files, which is everything you see or hear on the internet. IE, or FF download the files from the internet and store them in its temporary directory, and then displays the content to you.
EDIT: Whats up with this message eh? Its got a line above it, as though its a reply to some other thread.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
|
There is a class in the .NET framework that will do much of this for you: FileSystemWatcher[^]. Have you looked at it?
|
|
|
|
|
Just a couple of things on formatting your post.
1. Use the <code></code> tags for small snippets of code
2. Use the <pre></pre> tags for larger peices of code, like yours.
3. Alot of the lines in your code are '///' or blank lines, which just take up space and decrease readability.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
This looks remarkably like homework to me. Thats just the sort of Skeleton I might provide to a class and ask them to fill in the gaps!
Regardless why don't you have a crack and if you hit upon a specific issue then im sure someone here'll help you.
|
|
|
|
|
Strange, you post your message, and then the post is deleted shortly after...
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Hi,I need a Sample code for setting for example ReportViewer1.BorderStyle in my source file.when i run my project in C#,there is a error message for this code: ReportViewer1.BorderStyle="solid".How can i write code like this without using ReportViewer Toolbar before running the project to define my Report Page setup as like as BorderStyle seting ,page setup setting for example my papaer size to be A4 and margin setting and other properties of my Report without defining this properties at running time or design time only with writing code in source file in my report from ?
thanks
D.riazi
|
|
|
|
|
Davood Riazi wrote: there is a error message for this code: ReportViewer1.BorderStyle="solid".
Surely you need to supply some kind of enum rather than a string.
What does the documentation say? (Let me guess, you haven't read it)
Well, in that case I can tell you that the BorderStyle[^] property takes an enum of type BorderStyle[^]
Davood Riazi wrote: How can i write code like this without using ReportViewer Toolbar before running the project to define my Report Page setup as like as BorderStyle seting ,page setup setting for example my papaer size to be A4 and margin setting and other properties of my Report without defining this properties at running time or design time only with writing code in source file in my report from ?
By reading the documenation. It is all in there.
Upcoming FREE developer events:
* Developer! Developer! Developer! 6
* Developer Day Scotland
My website
|
|
|
|
|
Hi dear Colin Mackay
Thanks alot for your response.
D.riazi
|
|
|
|
|
Hi All,
I am adding a string value to listbox control. I need to set the width of listbox in runtime base on how many pixels string need it to display it within listbox. Idea is to set a width of listbox exactly the number of pixels required by string value. So, I can have perfact width each time base on string value.
Any idea please help.
Thanks,
Asif.
A.Asif
|
|
|
|