valter 0 Junior Poster in Training

I have recently purchased a windows 7 pc.
I am having a problem with virtualstore.
I have installed a program that downloads tv timetables to the pc.
I am trying to delete the existing files before doing a download.

I have written a little c# program to do this. In xp it would be a doddle, but w7 has me stumped. When I do a search the path for the files is c:\users\"user"\Appdata\Local\virtualstore\program files (x86)\

I am reading the path from a textfile then trying to delete the files.
My program can't navigate to the directory - any help will be welcome.

Thanks

valter 0 Junior Poster in Training

Thanks to all who responded. I have found that when the screen goes black I can unplug the monitor from the pc and plug it straight back in and the display is ok. I am still uncertain what to do. I have checked power settings, and have thought about replacing video card.

valter 0 Junior Poster in Training

IU have encountered a very puzzling problem.
The symptom is that suddenly the monitor goes black, the pc sound is still on. This happens in a seemingly random way, it might be minutes between events or hours.

I have found if I unplug the monitor cable from the pc the monitor puts up its usual searching for signal message.
If I then immediately plug the monitor back in the pc, the monitor has normal display.

I have tried inspection of the cable and wiggling the connection without any result.

I am currently thinking this way. Since when the failure occurs the monitor goes black, without the signal missing message, that it is the monitor that is faulty. If this is true then why does it come on again immediately when plugged in again.

Any ideas welcome. But I do not have access to another monitor

valter 0 Junior Poster in Training

Thanks to Samueal I soved the problem.
For those interested.
Go to tools/options and choose expert settings, config manager will then be available.

valter 0 Junior Poster in Training

I can only see Build solution, ie there is no config manager.
I am using the express version of vs 2010

valter 0 Junior Poster in Training

Samueal has expressed it better than I could. Sorry about the question it doesn't make sense to me either, but it is happening.

valter 0 Junior Poster in Training

I am having a bit of a problem building my app.
This is what I'm doing. Perhaps someone may be able to point out where I'm going wrong.

When ready to build I click on solution explorer, properties and open, build tag. Output path is bin\release\. Yet when I do a debug, build solution, and then using explorer look at the exe file that has been produced it may be several days old.

My problem appears to me, that I am unable to build the latest version with any reliability.

valter 0 Junior Poster in Training

Sorry,
I didn't make my point clearly.
I wasn't saying you can't install in another directory, what I meant was
if you install vs then later change your default program directory you will get intellisense message errors.

valter 0 Junior Poster in Training

Hi,

I am not looking for a response to this, but I thought I would post this info which might help others in the futture.

If you change the default install directory say from C; to something else, which you might do if your c: drive is getting full.

Please note Visual C# express will crash when you try to runa project.
The error message is "Intellisense has encountered a problem etc".

valter 0 Junior Poster in Training

I am trying to show a mov video using quicktime dll.
I have made a bit of progress, but still have a problem.
Vce won't allow me to drag the control on the form.
So I figure I should be able to provide a reference and use the control to show the video. What I find when I run the code is that the url property loads the file path ok, but the control stays set at null.
This triggers a nullReferenceexception.
I can't figure why it stays null, when I am creating a new instance in the code.

using QTOControlLib;


QTOControlLib.QTControl qt = new QTControl();
qt.URL = @"H:\ImportAll\102_0055.MOV";
qt.MovieControllerVisible = true;
qt.Movie.Play(1.0);
valter 0 Junior Poster in Training

Thanks I will,
However I have found that older articles don't help much because prior to 2010, video was easy, but 2010 release of vce seems to have made it very difficult, as most of the tried and true ways don't work anymore eg. quicktime, ms directxaudiovideo etc

valter 0 Junior Poster in Training

I am finding that vs2010 seems to have problems playing videos.
I will be very grateful if anyone can point me in the right direction.

I can play avi etc on Windows Media Player ok.
But I need to play mov files in my app.
I have tried quicktime, but cannot drag the tool to my form without getting an error message about the activex not being registered, although it is.

I have tried axvlcplugin2, this goes to the form ok, but when I try to run with it the code in the designer causes an error.

((System.ComponentModel.ISupportInitialize)(this.axVLCPlugin21)).EndInit();
 this.ResumeLayout(false);

The line above which was generated by the designer causes an error, because it's generated by the system I don't think I can use it in a try statement.

Prior to 2010 video ran ok, now even the directx.audiovideoplayback doesn't work.

valter 0 Junior Poster in Training

I finally solved it, albeit by a quick and dirty way.
I am putting my solution here for anyone that has a similar problem.
I researched and could not find a way to stop an exception being thrown in the try statement which stopped the code.

I then thought maybe I can test for the condition that stops the code.
When I looked at the number of Image.PropertyItems in a normal photo there were 52, I checked the offending picture it had two, so I checked the Image.PropertyItems.Length and if it was under say 40 I would not try to get the property item, over 40 it was ok the program wouldn't crash.
Thanks to Momerath for his/her suggestions.

valter 0 Junior Poster in Training

Thanks,
I have tried that but the program keeps stopping in the dll.
The strange part is that if I step thru it will stop, and then go to the catch statement on the next step.

But while it's running the program crashes. The routine works fine with most pictures, but as I said before I don't think the scanned image has that property.

What I can't understand is why a try statement doesn't work.

valter 0 Junior Poster in Training

I'm not sure about the managed unmanaged issue, it's just a dll I wrote myself witha few functions handling photos.

Just tried externalexception in the dll itself? But it still has the same problem. Should I use the externale4xception in the calling routine, rather than the one I am calling.

using (Image img = Image.FromFile(imagefileName))
I think this makes it an image class.

valter 0 Junior Poster in Training

I have an external dll that provides the time and date a photo has been taken

I am getting an argumentexception for a certain image. I believe it is because it is a jpeg from a scan, so it doesn't have a datetime.

My problem is that even with the call being in a try/catch statement, the error stops the program before it goes to the catch. Is there any way I can prevent this.

try
                {
                 //check for datetakentag if present return datetime taken
                 string dateTakenTag = null;
            dateTakenTag = Encoding.ASCII.GetString(img.GetPropertyItem(DATE_TAKEN_TAG_ID).Value); 
}
catch (ArgumentException e)
                {
                    int year = Curr.Year;  etc.
                 }
valter 0 Junior Poster in Training

Hi,
I have two short questions that I have googled without any result.
1. How do I use sendkeys to send a click of the control key.
I have found lots on ctrl key plus other keys, but all I want to do is the ctrl key it's not even mentioned on MS site,.

2.The other problem is with a runtime menuitem. I am trying to change the font size, it's easy if done at design time, but I need to do it at runtime.

Thanks for any help.

valter 0 Junior Poster in Training

Fair enough. I am writing a program that scans all photos, and finds and displays similar looking ones.

I have an algorithm that analyses each pixel and stores the results in a hash table, I could have used just the stats, but the hashcode appealed because it is reliable, has the same number of characters each time, and apparently can be searched efficiently.

I am happy that the routine works and produces the results, ie the hashtable codes identify similar photos. When I use the term, like items I mean similar looking photos, some that are exactly the same, and some that are nearly the same. I anticipate that out of 2000 odd codes about 20 will not be unique, these are the ones I want to capture, and show in a Listview image control.

Reading I can see the List.FindAll method might work, but I can't understand predicates and the syntax. Hence I am looking for ideas on how to accomplish the task.

valter 0 Junior Poster in Training

I realize I made a mistake with the second approach I referred to of course adding the index into the hashtable would mean that the entries would never match.

Please disregard the second part of my query.

valter 0 Junior Poster in Training

I'm ok with reading things into memory a list or an array.
What I would like to do would be to group like items, I can't sort the table as it is currently in the order needed.

I don't understand hash tables, so my values don't have a key in them.
I thought what I could do is to group the items that are the same, and retrieve the photo according to the index ( the order of the hashtable).

Another thought I had was to add a key(not sure how) with the index, then the table could be sorted to allow easy grouping of the items, and the get the index, and thereby the photo.

I hope this makes sense.

valter 0 Junior Poster in Training

I have got a hashtable that holds an analysis of individual photo characteristics. There are duplicate values in the hash table. Can someone explain how I can get values that are not unique,ie there is more than one entry the same.

My hashtable is in the form of a text file.

valter 0 Junior Poster in Training

Thanks to all,
Great solutions.

valter 0 Junior Poster in Training

Hi,

I am trying to combine two arrays to a multidim one.
I have two int arrays stat[] and indexes[].
So the first looks like this 34,56,78,etc holding hundreds of numbers.

The second looks like this 0,1,2,3,4,5 etc.

I want to end with a multidim array like this 34,0 56,1 etc
I want to sort the first dimension while keeping the second dimension locked and staying with its stat.

I know how to create a multidim array, I'm confused about how to fill the values.

valter 0 Junior Poster in Training

Momerath,
Thanks for your comments. Looking at your method it seems as though it only has a difference on one dimension, whereas I need it on 3 simultaneously. This is the hard part for me.
abel, I'm sorry some of your comment appears to be missiing, I couldn't comprehend what you eman.

valter 0 Junior Poster in Training

Hi,
I am seeking some advice about how to tackle a programming problem.
I'm not wanting code just some suggested ways of handling the problem.

I am trying to develop a program that displays images that have similar visual properties. For each image, and for each of the rgb colors I have developed numbers in the way of a profile eg. 1 image might be R132.05,G124.12,B104.60.

Now I have established that + or - say 2% of each of these values is relevant.
Assume I have a few hundred images, I would like to be able to group images that fall within +or- 2% margin of each image for each of the rgb stats.

I would see the outcome as being say a few groups of 5 or 6 images each, with a lot that are not similar enough to group.

All suggestions welcome.

Thank you

valter 0 Junior Poster in Training

Thanks very much to all who responded.
Your answers were of great help to me. I never realised I could remove controls, as well as add. Of course looking at it now it seems obvious, but it wasn't obvious to me before.

Thanks again

valter 0 Junior Poster in Training

Thanks,
I'm not sure how to remove them, as they are only added using add controls.
I thought disposing would remove them.

valter 0 Junior Poster in Training

Hi,
I have a problem with filling a form dynamically.
I have a form to which I add labels and textboxes.

They are dimensioned globally as
Label[] newlbls = new Label[30];
TextBox[] newtxts = new TextBox[30];

The first time I add controls there are four labels required. Everything works fine, after I add the controls to the form. But then I dispose of all the controls and run it a second time with only three labels, the problem is the form continues to see the label array as having four labels, and as I only create three new labels. It throws an object disposed exception.

The problem seems to be in the first run there are 4 labels in the second run there are only 3, so the fourth one throws an exception.

I have tried setting array to null. Fails because then can't create new label.
I've tried disposing of label also doesn't work.
I've tried setting each element to null, also doesn't work.
I realize if I dimensioned the label array in a method, it might fix it, but then I can't access label outside the method.

Anybody please?

valter 0 Junior Poster in Training

Mitja,

Thank you, this is the type of straightforward direction I needed.
I knew I was totally confused. I will work with your examples and see how I go.

valter 0 Junior Poster in Training

No I'm afraid I spoke too soon.
I still have the problem.
Snippets are difficult as they are taken out of context but I'll try.

As a global definition

Form newF;

later in code called - which is the first time the form is called
Form newF = new Form();

All goes well - then when the form is accessed again in a different method (without being shown yet)

newF.Text="Edit or enter text for " + lv.Columns[si].Text;
newF.Height = coOrds.Count * 30 + 150;

accessing newF crashes.
The exception is Object reference not set to an instance of an object.
Null reference exception is unhandled.

I notice my Global definition is different, and I suspect this is the issue, but I am uncertain what my definition should be like.

valter 0 Junior Poster in Training

Thanks to all,
Mitja,
Your example shows where I was going wrong. I was calling a new form globally rather than creating a global variable. If I understand your point, button1 creates a new form shows it and when the form is closed, button2 creates the next instance etc.

valter 0 Junior Poster in Training

I am totally confused about forms in c#.
If someone can explain the following simply please.

I have a main form - called Front.
under the section partial class Front : Form
I have a Form newF= new Form();

More than once in the program I call the newF form with different button layouts etc. I close it each time so that the display changes as required.

Sometimes I get an exception error because the form doesn't exist.
As I understand it I need to check if newF exists, before calling am instance.

The problem is if I try code to check if newF exists, the program says I can't refer to it when it doesn't exist.

How do I overcome this please?

valter 0 Junior Poster in Training

I have made some progress since asking this question. There is nothing wrong with the code, but the button on the website is in javascript.

<td><a id="ctl05_lbSubmit" class="submit-btn redbtn dark" href="javascript:__doPostBack('ctl05$lbSubmit','')"><span>Submit</span></a></td>


So my question now is how do I do a
wb.Document.InvokeScript( );
function for the data above.

Thanks

valter 0 Junior Poster in Training

Hi;
I have a problem with webbrowser control. Code runs ok till it gets to
HtmlElement submit line where it returns a null error message
Object reference not set to an instance of an object.
The code works fine with the first element but not the second.
I would also like to save the website when the submit button is clicked.
Any help most welcome.
Thank you

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlElement dropdown = this.wb.Document.All["ctl05_ddlGroupSelector"];
            dropdown.SetAttribute("selectedIndex", "1");
            HtmlElement submit = this.wb.Document.All["ct105_1bSubmit"];
            submit.InvokeMember("click");
        }
valter 0 Junior Poster in Training

Thanks Momerath,
That's not the situation with me. Although I have 2005 and 2008 VS on my PC.
This is a bit of an own goal for Microsoft, as it forced me to do a separate installation rather than overwriting the older programs.
Also I can't get to the link provided and only get an error message.

MS have really stuffed me now, I have put hundreds of hours into my project which now won't even run with basic controls.

valter 0 Junior Poster in Training

This has started happening when I run my project, the code that triggers this is simply if I enable or make visible a toolstripmenuitem.
I have no idea what this is alluding to or how to stop it. If I rem the lines out, it simply happens with the next control which is a calendar

valter 0 Junior Poster in Training

Thank you Luisphur.
I looked through the MS error report and I noticeit's looking for a CustomOpenFileDialog file. This is one that I downloaded and tried out, the deleted it from the project. Here's the rub, I can't find a trace of it in my program, doing a text search for Custom etc, and looking at every file in the project.

Somewhere in this program's DNA it knows about the file, any suggestions to deal with this?

valter 0 Junior Poster in Training

Thank you for your response.
The problem has now changed. I published the code and tried to run it on my xp, it also crashes. I can't figure this because it works beautifully using the ide.

valter 0 Junior Poster in Training

I have written a program that works well on xp. However when I install it on vista it crashes. I simply used publish and don't really know where to start looking. I have checked and net framework is on vista pc.

Any help welcome please.

valter 0 Junior Poster in Training

I have completed a c# project done the build, but when I try to install it on a vista machine, It gives the message "Application validation did not succeed."
I have googled and tried a few things but without result.
Any help welcome.

Thanks

valter 0 Junior Poster in Training

I have written a regex that works well except that it always puts the last word on a line of it's own. Can anyone see where I have gone wrong, this is my first attempt at regex. The text is of variable length.

Basically my regex is trying to
1. Limit numbers of any character to 100
2. So that each element of the array holds as close to 100 characters without cutting into a word.

    string pattern=@"(.{1,100}\b\s)";
     Regex rex = new Regex(pattern);
     string[] Str = rex.Split(Detail);

Thanks for any help

valter 0 Junior Poster in Training

Hi,
I am looking for a way to split a series of sentences to no longer than 100 characters per line, but with the split being on a white space, so that words are not broken.
Is there a regex or some way to do this.


Thank you

valter

valter 0 Junior Poster in Training

I wrote a dll and referenced it ok in my project.
I then added some additional functionality to dll and find I cannot get the project to use the updated code,

I have tried deleting the dll and rewriting it, rebuilding both dll and project. Deleting the reference saving then re adding the reference. Nothing I do will make the program use the new version.

I'm obviously missing something obvious, I just don't know what it is.

Please help if you can.

valter 0 Junior Poster in Training

Thanks a lot.
"Smacks head with hand."
After altering a dll and rebuilding do I just delete the old one and add a new reference to refresh it?

valter 0 Junior Poster in Training

Hi,
This has been driving me crazy so I hope someone can assist.
I have a project with several custom dlls being referenced.
I have found that although I add changes to my dll and rebuild etc, the program uses the old version.

When I look at add reference there is no way to remove a reference. I read about people saying remove a reference, I just can't see a way to do it.

Thanks

valter 0 Junior Poster in Training

Thanks Diamond,
That control is awesome

valter 0 Junior Poster in Training

Diamond.
Thanks for your comments. I did recognize picbox would paint every time but I have an if that tests whether it should.
I am intrigued by your idea of a usercontrol, haven't used image list. When you say create a new picbox for each thumb, I thought I would be faster to put each image in same picbox in memory then show it. Am I understanding you when you say use a separate box for each image?

valter 0 Junior Poster in Training

Thanks D.

I had a look at the links, but don't understand, I will do more research on the thread idea.

valter 0 Junior Poster in Training

Hi,
I have been trying to solve this problem without any luck. Can someone please have a look at this code as it doesn't work

Thank you

After clicking a button I refresh the picture box the
code below is in the picbox.Paint event. Basically what I am trying to do is to write a series of thumbnails to a buffer, then show the screen with all the thumbnails in place,
I can do it without buffering but it is very slow.

Any help welcome

_Buffer= new Bitmap(363,420);
            Graphics g = e.Graphics;    
            for (int y1 = 0; y1 < 12; y1++)
                {
                    Point P1 = pp.Get_ThumbNail_Point_Pos(y1);
                    theImage = new Bitmap(pp.pics[y1]);
                    imgThumb =    theImage.GetThumbnailImage(98, 98, null, new IntPtr());
                    g.DrawImage(_Buffer, P1);
                    theImage.Dispose();
               }
              e.Graphics.DrawImageUnscaled(_Buffer, 0, 0);
            return;
valter 0 Junior Poster in Training

I am still wrestling with this class code. Using what sknake sent this is an excerpt from a method in the class.
Now this works fine eg ps[1]= a file name etc

if (Parts.Length > 0)
                Title = GetTitle(parentName);
            ArrayList ps = new ArrayList();
            for (int counter = 0; counter < Parts.Length - 2; counter++)
            {
                PersonalPhoto P = new PersonalPhoto();
               // PhotoStuff P = new PhotoStuff();
                P.FileName = Parts[counter];
                ps.Add(P.FileName);
                P.DateTaken = GetDatePictureTaken(temp);
                ps.Add(P.DateTaken);
                P.Title = Title[counter];
                ps.Add(P.Title);
            }

Here's the thing I am trying to load an arraylist of objects with each object having several text properties. Now if I try to do this with this modified code below, I can see each element of the arraylist but not the properties belonging to each object P. I have read many books over the past few weeks and rewritten the code a lot, but I just can't make this work.

Any takers please.

if (Parts.Length > 0)
                Title = GetTitle(parentName);
            ArrayList ps = new ArrayList();
            for (int counter = 0; counter < Parts.Length - 2; counter++)
            {
                PersonalPhoto P = new PersonalPhoto();
               // PhotoStuff P = new PhotoStuff();
                P.FileName = Parts[counter];
                P.DateTaken = GetDatePictureTaken(temp);
                P.Title = Title[counter];
                ps.Add(P);
            }