15,790,884 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Adam David Hill (Top 34 by date)
Adam David Hill
30-Jun-13 19:09pm
View
I did, although I believe Shared is supposed to be cheaper. I'm beginning to think that the decimal place is wrong in the calculator's monthly summary. Incidentally, the prices appear to have changed since I originally entered it. It quotes £0.009 per hour or £47.35 per month for 1 website. At ~1 pence per hour with an average of 740 hours I'm pretty sure that should be ~£7.40 per month, which is actually reasonable.
Adam David Hill
14-Mar-13 16:34pm
View
It looks like the row highlight for that element. If you click on the text saying "RickTextBox" above it does it move to that?
Adam David Hill
14-Mar-13 14:32pm
View
I'm guessing here as I can't see the screenshot, but is your image by any chance part-transparent and PNG format? This sounds like it could be a control or framework which does not fully support the PNG format, and defaults in a background colour.
Adam David Hill
14-Mar-13 14:31pm
View
The link you have given us needs a password to the forum. Please can you send a direct link to the image which is not password protected?
Adam David Hill
13-Mar-13 18:24pm
View
Ah, sorry. For now you can just write "static" before the word "int". It's not ideal, but will achieve the desired result in a quick & dirty way. A better solution would involve making a new class to hold those values in, and then you'd pass an instance of it into the second function. I'm guessing those might also be new concepts (read up on classes, instantiation and static) in which case just stick "static" there for now. I'm not saying that's your final solution - there'll be some work to do in your 2nd function to decide which of those values to use according to the name you've passed in, but I'll leave that to you. (Hint: "switch" or "if")
Adam David Hill
12-Mar-13 19:34pm
View
I'd presume your app will be sandboxed so you can't go "snooping", even for a legit reason like this. This is just a hunch though, and my experience is mainly with WP7 rather than 8.
Adam David Hill
12-Mar-13 11:01am
View
I'm not sure the asker is talking about execution times. Sounds like they simply wish to display any given % value on a gauge / control.
Adam David Hill
21-Sep-12 4:04am
View
Can you show some code, specifically how you put the values into those controls in the first place?
By what means are you deciding which row you want to read? Is there some particular event happening related to that row, or maybe you want to retrieve it by index etc.?
Adam David Hill
21-Sep-12 4:01am
View
It would be easier to do it with backend code, and when you loop through the files creating a list, actually make a list of a custom class instead, where you would programmatically manipulate the strings. You can use StringFormat to modify strings in bindings but I'm not sure it's powerful to do what you ask. Another approach is to write a custom IValueConverter (just search for a tutorial) on that column's binding. This converter would take the full path and trim it down to just what you need.
Glad it worked for you.
Adam David Hill
20-Sep-12 11:51am
View
Also you're inconsistently using .Trim() in one place where you reference the textbox's text and not the other. For safety, read the text into a string variable at the beginning of the method, trim it there if desired, and subsequently only refer to the variable in that method.
Adam David Hill
20-Sep-12 11:42am
View
Hi Vikram, not that it will likely make a difference, but there's a small slip in that function which was my fault. Use this tweaked version to use the parameter rather than directly referencing the text box...
bool IsUserIdTaken(string userid)
{
var objctx1 = new myDomainContext();
bool hasReg = objctx1.registrations.Where(i => i.userid == userid).Any();
bool hasMem = objctx1.members.Where(i => i.userid == userid).Any();
bool hasPst = objctx1.pastmembers.Where(i => i.userid == userid).Any();
return hasReg || hasMem || hasPst;
}
Adam David Hill
19-Sep-12 11:00am
View
I'd start by creating a UserControl which represents a single digit/character. It would expose a property of the digit it represented, and display that character.
Once that's working you'll want another control to create instances of the first control, one for each digit. It would have a public property for the number it was required to display.
For the animation side of things just search for a tutorial on the subject - there are plenty around.
Bear in mind on this forum you won't get someone to just write all the code for you. Ideally you give it your best shot and ask a question when you have a specific problem. The answer to "how do I build X" is a very broad question which can't really be answered without someone building it for you.
Adam David Hill
19-Sep-12 6:06am
View
Could you explain why data-binding won't work? Perhaps show some surrounding code?
Adam David Hill
18-Sep-12 19:20pm
View
Is there a specific aspect you're stuck on? Have you tried translating and got stuck somewhere specific?
Adam David Hill
18-Sep-12 6:44am
View
Reason for my vote of 5
Well written and an interesting problem. :)
Adam David Hill
17-Sep-12 10:08am
View
I can't see it'll make much of a difference but you could try executing that code in the Loaded event rather than in the constructor.
I was beginning to suspect it was a mismatch in character sets or something like that, but this line doesn't rely on the where clause:
MessageBox.Show(objctx.registrations.ToList().Count.ToString());
Unfortunately I think I'd pretty much need to see the rest of the project to help any further. If you can't debug your View, then can you not put the code to examine the data somewhere you can? If that's View as in MVC or MVVM then there probably shouldn't be database code in there in the first place.
If I think of anything else I'll let you know.
Adam David Hill
17-Sep-12 8:47am
View
Well, as frustrating as this is, at least that is a good sign!
I guess the next step is try a hardcoded userid comparison again but in that new page (in case there's something on your other page which is interfering). Hardcode a single id in your C# code for now so you know 100% it's not because it can't read the text out of a control or something. Something like:
var query1 = objctx.registrations.ToList();
var query2 = objctx.registrations.Where(i => i.userid == 'myUserId');
var query3 = objctx.registrations.Where(i => i.userid == 'myUserId').Count();
Stick a breakpoint on the next line and each version of "query" to see if there are any results / what they are.
Adam David Hill
17-Sep-12 7:40am
View
Okay, just to make 100% sure - are you connected to the same database instance you think you are? Can you select anything at all from this database? If so can you manipulate some test values directly in the database and see the changes in VS?
Adam David Hill
17-Sep-12 4:10am
View
That's very strange. It shouldn't be the code above that's the problem, at least. Can you try testing it with a hard-coded string in both the app and SQL Management Studio? Try a SQL query like "SELECT * FROM registration WHERE userid = 'writeYourIdHere' ", and then also hard-code the string in the C# code above, replacing the userid_txtbx.Text part with "writeYourIdHere". Does one work and not the other? If neither work then try examining the userid for hidden characters.
Adam David Hill
16-Sep-12 10:19am
View
Looks like you haven't created a template for the datagrid's columns. The data is "in" the datagrid okay, but you need to define a template in the XAML to say what it should look like. Check out the tutorial here: http://wpftutorial.net/DataGrid.html.
Adam David Hill
16-Sep-12 6:28am
View
Okay, no worries. Just a final couple of ideas. One is to either use all caps or small caps (or maybe Bank Gothic font etc.) to ensure the height of every character is the same (I'm assuming you're using text and not symbols). The other is to write an IValueConverter to calculate the margin by scanning the string and checking for characters like lowercase g, j, p, q or y etc. which have descenders and giving a dynamic margin offset. If using the Bank Gothic font approach check that the capital Q doesn't screw things up. Best of luck with this...!
Adam David Hill
15-Sep-12 19:41pm
View
Ah, I see. You could use a Margin with negative values to counteract the spacing in the font. The trouble/risk would be that the word google (lowercase) vs. GOOGLE (uppercase) would need different values due to differing ascenders / descenders.
Adam David Hill
15-Sep-12 8:51am
View
Hmmm... have you tried setting Stretch="Fill"? It depends whether you don't mind distorting the aspect ratio of the text, but maybe experiment with that property? http://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox.stretch(v=vs.95).aspx
Adam David Hill
29-Jul-12 19:21pm
View
Also, we'd need a bit more information on what you mean exactly by "It runs well on some machines but doesn't works on others." - how should it work and what are you seeing?
Adam David Hill
2-Jul-12 4:54am
View
Could the down-voter please explain the negative mark? The code above is tested and working.
Adam David Hill
2-Jul-12 4:39am
View
That's a separate question, so you might want to post it separately to this thread. I don't have VS handy to try but I suspect you need to use control templates. If that doesn't work consider rethinking the use of the context menu in favour of using your own control. I'd need more information about what you want to do to advise what the most appropriate controls would be. You could probably use templated ListBoxes instead of ContextMenus, for example.
Adam David Hill
1-Jul-12 7:26am
View
Just as an additional remark - the key is to create child items which have click events - it's not a problem with the Accordion, rather with how you're handling the items which you put in. As you were using ContextMenus, then to interact with their own children, use MenuItems. Hopefully that's clear from the code above.
Adam David Hill
30-Jun-12 5:14am
View
Where are you subscribing to the OnMouseLeftButtonDown event? Do you have something like "item.MouseLeftButtonDown += OnMouseLeftButtonDown;" anywhere? One quick thing to try - change the fill of the rectangle to ever-so-slightly visible rather than purely transparent. I seem to recall totally transparent things don't tend to pick up mouse events.
Adam David Hill
21-Jun-12 12:24pm
View
I think you need something like dataGridView1.Columns rather than just dataGridView1. You'd have to explore the properties of DataGridView. It may be that it's better to iterate via the rows rather than the columns - the heart of the solution provided was that however the control likes you to do it, you essentially want to iterate all the cells.
Adam David Hill
20-Jun-12 7:14am
View
To manipulate the values you'd write something like: CheckList[2].IsSelected = true; - i.e. you're manipulating the values of the CheckList property. To add a new check box you'd use CheckList.Add(new CheckListItem{... etc. Whether or not you store this in a database or not is a separate question and should probably be asked in another thread. Hope that helps. Please mark as the answer if this solves the question of how to use that XAML with code behind.
Adam David Hill
11-Jun-12 18:52pm
View
Just to clarify what I meant with my idea; exporting WPF paths to SVG is actually not so bad. Exporting general UI controls is not. The main problem you face there is implicit templates - i.e. what you're trying to export is partly the default template of a control. If you build all the diagrams from scratch in basic paths then exporting isn't much of an issue as http://msdn.microsoft.com/en-us/library/ms752293.aspx is very similar to http://www.w3.org/TR/SVG/paths.html#PathData for the basics. As SAKryukov says, GDI+ and WPF are very different. He's provided some interesting links to get you going, though.
Adam David Hill
11-Jun-12 6:37am
View
This is more of an idea than an answer but hope it helps... Have you considered / looked into using SVG? It's fairly similar to XAML for paths and quite portable. You could maintain objects' basic path data, and then either render dynamically as generated WPF Paths for the UI or output as an SVG file for use with a generic application or printer. If your diagrams need to be interactive then it might get quite fiddly, but might be worth exploring.
Adam David Hill
5-Jun-12 6:21am
View
Okay can I check I understand you correctly, first? You have some data like this...
A
-A1
--A1i
--A1ii
-A2
--A2i
B
-B1
C
And want it to appear like this in a list box...? That is, every item at every level but flattened into a single list irrespective of their place in the hierarchy?
A
A1
A1i
A1ii
A2
A2i
B
B1
C
(Hope the formatting of this comment will be preserved...)
Adam David Hill
11-Jan-12 11:44am
View
Deleted
This would be the normal approach but unfortunately there is no ColorTranslator in Silverlight (at least in v3 and below - I don't know if they added it recently). This means you have to write your own.
Show More