|
When I used to execute my code, I used to be able to step into the following line of code in my PC class, and it went to my GetProgramControl method, where I could step some more.
controls[i] = (Control)_type.InvokeMember("GetProgramControl", BindingFlags.Default | BindingFlags.InvokeMethod, null, _objectInstance, _parameters);
For some reason, I was stepping into that at one point, and it was having trouble finding my SN.cs and I hit the link to browse to show it where it was. Ever since then, every time I step into the line above, it goes directly to the later reference of my SN class and the debugger is in a method there. Any ideas how I can get the debugger to stop in the PC class GetProgramControl method? I can't put a breakpoint there because it's outside of my class that is calling it.
I looked at the following but it's different since my SN class isn't a child of PC, it's a reference used in it.
http://bytes.com/topic/c-sharp/answers/439984-cant-step-into[^]
I also saw this and it might be similar but it doesn't look like anyone had a solution for him: http://www.codeproject.com/Messages/2932838/Can-t-step-into-method-debug-with-F11-in-Visual-St.aspx[^]
|
|
|
|
|
I figured it out. My dll was out of date that was being referenced/called from the above line of code.
|
|
|
|
|
How can catch the exceptions if my parent and child pages are from different domains.
My agenda is to:
load content using iframes from a cross domain. If the loading fails, catch the exception and retry. If the retry fails too, catch the exception and throw exception.
I know it's easy to do it if the parent and child are from same domain.
Please help!!! Thanks in advance
modified 29-Nov-12 18:09pm.
|
|
|
|
|
Hello Every1. I have made a windows form application on server client methodology. This works good when I open reports on server but when I open reports on client side then I get the error "Load Report Failed".Please help me about fixing this error??
Thanks
|
|
|
|
|
I am getting the following error message in a C# 2008 application and I do not know what to look at to resolve the problem:
Error2Build failed due to validation errors in C:\RPT.dbml. Open the file and resolve the issues in the Error List, then try rebuilding the project.
There is nothing showing me where the exact error is coming from. There is a reference setup for System.Configuration.
The following code is from the RPT.designer.cs
namespace cli
{
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Data;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel;
using System;
using System.Configuration;
[System.Data.Linq.Mapping.DatabaseAttribute(Name="DEV")]
public partial class RPTDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
public RPTDataContext() :
base(ConfigurationManager.ConnectionStrings["DEVConnectionString"].ConnectionString.ToString(), mappingSource)
{
OnCreated();
}
The following code is from RPT.cs file:
namespace cli
{
partial class RPTDataContext
{
}
}
Here is the code in the app.config file:
<connectionStrings>
<add name="DEVConnectionString"
connectionString="Data Source=xxx;Initial Catalog=PROD1;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Thus can you tell me and/or show me in code how to fix this problem?
|
|
|
|
|
sc steinhayse wrote: Thus can you tell me and/or show me in code how to fix this problem?
What have you tried so far? Have you Googled it? When I did a quick Google, this[^] was the first thread - and it looks quite promising.
|
|
|
|
|
Hello!
I'm working on an application where you are able to see the chosen users outlook appointments for over 10 days. The program is supposed to be a gridview and it's supposed to loop through the users outlook for each day and add the appointments.
So far i'm getting all appointments from the selected user, but the program adds even the next days appointments in the first day.
I would be very thankful if someone could help me out with this. Maybe I'm supposed to change the loops? I'm getting all the columns created for the next 10 days.
Here's the code of my loops:
List<DateTime> NAME = new List<DateTime>();
DataRow drow = dt.NewRow();
for (int i = 0; i < 10; i++)
{
NAME.Add(DateTime.Now.AddDays(i));
DataColumn dcol = new DataColumn(NAME[i].ToString(), typeof(System.String));
dt.Columns.Add(dcol);
foreach (Appointment appt in findResults.Items)
{
if (NAME[i].Day == appt.Start.Day)
{ dt.Rows.Add(appt.Subject); }
}
}
I also wondering if there is some kind of way to calculate the duration of all appointment each day in minutes for example. To get the total amount of minutes of each day from the person. Is this possible?
Best regards,
Blenni
modified 29-Nov-12 9:29am.
|
|
|
|
|
I'm not sure what you're trying to do here. What you're actually doing is adding a new row for each appointment, with the subject in the first column.
I think what you want is
List<DateTime> days = new List<DateTime>();
for (int i = 0; i < 10; i++){
days.Add(DateTime.Now.AddDays(i));
DataColumn dcol = new DataColumn(NAME[i].ToString(), typeof(System.String));
dt.Columns.Add(dcol);
}
foreach (Appointment appt in findResults.Items){
int index = days.FindIndex(dt => dt.Day == appt.Start.Day);
if(index > 0) {
DataRow dr = dt.Rows.Add();
dr[index] = appt.Subject;
}
}
|
|
|
|
|
Big thanks!
The only problem now is that I'm not getting the appointments of the current day.
It shows the current day and 10 days forward but doesn't add the appointments for the current day, only the upcoming days.
Cheers blenni
modified 29-Nov-12 9:59am.
|
|
|
|
|
That can be an exercise in bug tracking
(It's a simple schoolboy error. It should be index >= 0.)
|
|
|
|
|
Yes sometimes u become blind in code. I found it hehe thanks.
I also wondering if there is some kind of way to calculate the duration of all appointment each day in minutes for example. To get the total amount of minutes of each day from the person. Is this possible?
Cheers!
|
|
|
|
|
That depends what information that appointment class has available to you. It looks like it has a Start and an End so you should be able to find out how much of each appointment is in each day and then aggregate it.
|
|
|
|
|
Hello all, what I am looking for is an easy way to change the properties of all controls of a specific type on a form. For example I've got a windows form which contains a couple of labels and buttons that I want to change to specific colors - no problem:
foreach (Control c in Form1.ActiveForm.Controls)
{
if (c == c as Label)
{
c.ForeColor = Color.Aqua;
}
if (c == c as Button)
{
c.BackColor = Color.Yellow;
}
}
BUT - this will only change the properties of the labels and buttons that are NOT in any panels, group boxes et cetera. If I have labels inside a panel, for example, they remain untouched.
What must I do to get'em all within one method?
Cheers
Dennis
|
|
|
|
|
Recursion.
List<T> GetChildren<T>(Control root) {
List<T> r = new List<T>
AddChildrenToList(root, r);
return r;
}
void AddChildrenToList<T>(Control root, List<T> list) {
foreach(Control c in root.Controls){
if(c is T) list.Add((T)c);
AddChildrenToList(c);
}
}
GetChildren<Button>(Form1.ActiveForm).ForEach(b => b.BackColor = Color.Yellow);
|
|
|
|
|
You need to do recursive searching. If the control you find in your first loop is a panel or any form of 'grouping' control, then call your method again pointing at that control, so you scan all its child controls. This will then continue down through all the trees until you have tested everything, something like:
scanner(Control parent)
{
foreach (Control c in parent.Controls)
{
if (c == c as Label)
{
c.ForeColor = Color.Aqua;
}
if (c == c as Button)
{
c.BackColor = Color.Yellow;
}
if (c == c as some_grouping_type)
{
scanner(c);
}
}
}
scanner (Form1.ActiveForm);
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Great, thanks so much! Worked out just fine this way.
|
|
|
|
|
You are welcome. Interestingly, of the four people who responded to this question, I put myself at the bottom of the list in terms of C# knowledge. Also, I think Pete O'Hanlon's suggestion makes more of the built in features of .NET.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You need to recurse through anything which can contain other controls.
public void ChangeColors(ControlsCollection parent)
{
foreach(var c in parent)
{
if(c is Label)
{
c.ForeColor = Color.Aqua;
}
else if(c is Button)
{
c.ForeColor = Color.Yellow;
}
else if(c.HasChildren)
{
ChangeColors(c.Controls);
}
}
}
Call it with ChangeColors(Form1.ActiveForm.Controls);
|
|
|
|
|
Something like this should work:
private void IterateOverAllControls(Control control)
{
foreach (Control childControl in control.Controls)
{
IterateOverAllControls(childControl);
}
if (c is Label)
{
((Label)c).ForeColor = Color.Aqua;
}
else if (c is Button)
{
((Button)c).BackColor = Color.Yellow;
}
}
|
|
|
|
|
c should be control
Other than that, pretty much same solution I came up with. Great minds, rodney, great minds!
|
|
|
|
|
J4amieC wrote: c should be control
Well spotted. At this point, I was looking at his implementation and hooking in part of his logic.
|
|
|
|
|
Hey Gurus,
I'm putting my Comm Port stuff together with my graphing stuff.
Is there any compelling reason for me to either of these possibilities ?...
[A] Require the same size packet for each data exchange
[B] Purposely avoid any such requirement
The environment and context of this is a small device controlled by a user GUI on a PC
|
|
|
|
|
There is no real rule - it depends on what you are talking to and how much data you are talking about. If most of your communications is "Are you alive?" "Yes" then fixing a packet size at 2KB is a heck of a silly idea. But if you want to transfer a 640x480 screen regularly instead, then a large fixed packet may be a good idea as it can help avoid memory fragmentation in the small device.
Horses and courses, I'm afraid!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
What I have is
-- About five little 10 and 20 byte packets and responses (Hello, ready, start, stop, what's the error ? and so on)
-- Packets of 16384 bytes each, with individual variations, sent over and over again; I think they hit me at one second intervals. I have to separate them into individual channels, then plot them on a graph, hopefully before the next package of data arrives.
-- Amidst all this, there is a super-tiny chance that I may need to handle a small packet.
I have control of the small box on the other side of the UART, at least for now; i.e., I wrote the comm routines in the box and I can change it if I want.
i.e., I could make it send individual 64 Byte packs if that would make sense in the multi-threading thing; but I just don't know ahead of time if large or small will work better.
|
|
|
|
|
I hope you have a fast UART! You're going to need at least 164K baud just to transfer the 16Kb packets in one second, let alone process them!
I would not use a fixed packet size - too much overhead. If at all possible, I would want to reduce the amount of data flying around - if you are using a UART you are probably RS232 or RS485, and the reliability drops as a function of both distance and transmission speed. The more data you throw at high speed (for the medium) the more chance of data errors/ retries. (If you are using USB then the TX speed can be pretty huge before it becomes a problem)
I would probably start looking at two threads - one to handle the raw data comms and extract the data blocks, then queue them up for the display thread. That way, the UI can continue in it's own merry way while blocks are stacking up for it.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|