|
Your remarks are all very true, i started programming PHP and very new to C#, about a week ago to be precise. I am trying to make a program that takes a raw text file of numbers and then converts those numbers into Chinese characters, which were hand drawn and scanned in as jpg. So the text file contains something like 1.2.3.4.5. and so forth, so the full stop allows the string to be split and placed into an array. This is then cycled through and the image added to word document which has the same number.
A few reasons for doing it this way is because i want to be able decided how the tables are laid out in word. So i might want them to list in columns and decide how many columns are on each page, the same with rows.
Overall you could say this is trying to automate the process of inserting images into a word document.
The script always works if the number is below 101, as soon as it goes to 102 or higher it causes the error. I have tried changing image names which i know work and the error still is thrown. Therefore, the error is thrown in my code but i don't know whether it could be word causing the problem
the error is on this line:
wordApp.Selection.InlineShapes.AddPicture(FilePath , ref missing, ref missing, ref missing);
saying that FilePath is not a valid file name
I would of thought it would of been an overflow problem if there was already a large number of images, however, if you just type 102 in the raw text file it will cause an error immediately, before it has chance to even add one file to the document.
Numbe is an array which contains all the numbers of the text file, one number in each element of the array.
|
|
|
|
|
OK, so no major surprises here.
You can declare string[] Numbe instead of Array; that way the compiler knows it will be strings and string operations are acceptable. Similar things for all your "objects": when you give them a more accurate type declaration, the compiler will be more capable of flagging errors if any, your source code will be more readable, and the running code will probably run a bit faster.
Try images 103, 101 and 102. If 102 is the odd one out, then check the image file itself, chances are it is damaged somehow (try replacing it with a copy of 101! ). [Sorry, this doesn't fit your problem description]
I suggest you print out FilePath before calling AddPicture; chances are you will see a problem with the file name. You might consider showing the code that produces the Numbe array, maybe something is wrong there.
As you are new to a language, I recommend studying a book[^].
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I have tried a mixture of numbers and images, which are copies of the same image. It works for a selection like:
1.4.8.120
as soon as you hit 120 it fails, same if that number is any number between 102 up. The files are ok as i have swapped them around many times. if the sequence starts on a high number like 103 then it will fail immediately.
thanks for your help.
|
|
|
|
|
I am using crystal reports in my window application in .net 2.0. I got the error as "Load Report Failed"
How can I solve this
|
|
|
|
|
be more specific. Otherwise it is hard to tell anything.
|
|
|
|
|
hi.
i have web page that contain a button. here is button's code:
<button type="submit" class="btn" style="width: 200; height: 22" onclick="setAction(method,'save');"><br />
<img border="0" src="/evocher/html/image/blt_01.gif" width="13" height="11"<br />
align="absmiddle">Register</button>
i write this code to obtain button:
mshtml.HTMLDocument doc;
HTMLInputElement registerButton = (HTMLInputElement)doc.getElementsByTagName("button");
but it generate runtime error, Invalid TypeCasting.
how can obtain this button?
|
|
|
|
|
getElementsByTagName returns a collection of objects. You try to treat it like a single object. I don't know the exact type of the collection, but I would assume that you need to cast it to something like a HTMLCollection
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
try
Button btn = (button).FindControl("the control Id goes here );
|
|
|
|
|
Unfortunately not. That only works for windows forms. This uses DOM, which is completely different. Also, you don't call FindControl on (button); that assumes you already have the Button instance. You call it on the Button's parent control
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
yes you are write i miss typed it it should be this. meaning that find control from this page.
|
|
|
|
|
is there any other solution to get button ?
|
|
|
|
|
I don't know. To be honest, casting getElementsByTagName to the correct collection, and then iterating until you find your button sounds like a fairly efficient approach
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I need to refresh my parent page from pop up using __doPostBack in javascript could any body tell me how i tried to googlize it but the information was not that helpful
|
|
|
|
|
I don't know how to do it using __doPostBack, but I imagine it would look something like this:
window.opener.location.reload();
You would probably get better results by asking this question in the Java forum though.
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi All,
I am creating windows app, with MVP architecture.I added a textbox and button to the window.xaml, so that my intention is to browse a folder on button click and display the path in the textbox.
If I select MyDocuments in browse click, then the entire path (C:\\Documentsandsettings\....\MyDocuments) should be displayed in the textbox.
I am new to MVP and as of now
1 . window.xaml with textbox and button
2. presenter class (windowpresenter.cs)
3. Interface class (Iwindow.cs) are created .
But, I am unaware of how to link these controls and how to use publish and subscribe these controls.
Please kindly help me in doing this.
Thank You,
Ramm
|
|
|
|
|
Hi To all
I`m very new to the programming and got stuck.
So i`ve been trying to write a program using Windows Form which include several different panels on. User can choose between which one is visible.
on each form there are few pictureboxes and my problem is .....
when you swich between them in the runtime it`s not smooth enough user can see loadning frames of these picture boxes for few miliseconds this is really annoying.
Is there any easy way of loading it in the background and show it after its ready or something ??? I started reading about threads etc but at the moment its quite difficult, i will be gratefull if someone could explain it with an example
Thanks in advance
Dims
|
|
|
|
|
You could call pictureBox1.SuspendLayout(); , load your image into the PictureBox, then call pictureBox1.ResumeLayout(true); to update the layout.
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
right i`ll try that but i forgot to tell you that on the form is background 800x600 bitmap so maybe that is the reason that is so slow.
|
|
|
|
|
It doesn't really matter, except that you might want to call SuspendLayout and ResumeLayout for the form as well. That might speed things up slightly, but I've not tested it.
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
It`s not working for me, what i`ve noticed is that all the panel as the user switches between do same thing whether there are only labels or pictureBoxes
so i`m assuming that there`s the problem with bitmap on the background of the form.
panels they are all set up as transparent.
any ideas??
|
|
|
|
|
Hi,
if your app is slow, try and figure out why and fix it. Are your images way too large and getting downscaled all the time? are you using some fancy transparancy stuff?
And did you look into double-buffering? you might try and set DoubleBuffered true. That does not really solve performance problems, it does hide some of its visual effects though.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hi everybody.
I have an C# desktop application, it support multiple instances.
but in my case, my application get 10-15 sec to load and if in between second instance get started, it will crash.
So i wish multiple instance application but even if there will be successive two double click to start application, second ,third instance should wait a while..
I have tried mutex but i have no detail idea of mutex.
Pls give me a way to do it
Thanks in advance.
|
|
|
|
|
Just a quick point - it'd be better to avoid crashes when multiple instances start by addressing that rather than delaying start up. Why does it crash?
You may be able to get a more granular critical section that way. Failing that then a Mutex probably is the way to go.
Regards,
Rob Philpott.
|
|
|
|
|
Hi Rob ,
Thanks for reply/
I am not able to find a reason for crash but it may be reading/writing file at a same time.
Any idea about mutex.WaitOne(...)
Thanks
|
|
|
|
|
Anybody know where I can find a decent Class Generator that will generate classes for me based on Access 2007/2003 tables? Preferrably Access 2007.
|
|
|
|