|
thank you...
|
|
|
|
|
thanks V..
|
|
|
|
|
you're welcome
V.
|
|
|
|
|
ausia19 wrote: .i guess the error has something to do with
Don't guess. Paste the entire Exception.ToString here, the error-message will point where the problem is.
ausia19 wrote: reply asap
..not today
Bastard Programmer from Hell
|
|
|
|
|
Good day
I am using Visual Studio 2010 to develop a Windows app. I am busy with a module where the user can specify setting for days of the week, for example Mondays the lunch duration is 1 hour, Tuesday it is 30 minutes, and so on.
I want to display the days of the week (Sunday, Monday, …) in a ComboBox so that the user can select a day.
The DisplayMember must be the name, e.g Monday
The ValueMember must be the ordinal number of the day in the DayOfWeek enum, e.g. 1
How do I populate the ComboBox using the DayOfWeek enumerator?
I tried:
private void Form1_Load(object sender, EventArgs e)
{
for (int j = 0; j < 7; j++)
{
comboDay.Items.Add((DayOfWeek)j);
}
}
private void comboDay_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show("Selected Day = " + comboDay.SelectedValue);
}
This shows the DayOfWeek names in the combobox, but the SelectedValue is always null.
Any suggestions on better ways of doing this?
Thanks.
Kobus
|
|
|
|
|
Use SelectedItem instead of SelectedValue .
|
|
|
|
|
Thanks
I feel a fool for not thinking of that.
Regards.
Kobus
|
|
|
|
|
It's always the way. As soon as someone else looks at it, you see it.
|
|
|
|
|
public static List LI = new List();
|
|
|
|
|
Unless you've created your own class called List, you are missing the generics part. You should declare it like this (assuming it's a list of ints for instance):
public static List<int> LI = new List<int>(); A few points:
1. Your question should not be the header. Make it part of the post instead.
2. Calling a list LI isn't a great idea. You should always look to use meaningful names in your code.
3. Use <pre> </pre> around code samples. The code tool in the editor toolbar will help you with this.
|
|
|
|
|
PLSSS DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
And while you are at it, drop the txtspk as well...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
OriginalGriff wrote: PLSSS
Please don't use textspeak.
OriginalGriff wrote: DON'T SHOUT
Isn't that a paradox?
|
|
|
|
|
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
When using VKontakte API method wall.get or friends.get client receives a response just once. When increasing for example the offset parameter such requests do not pass. An error is returned InnerException = {"The request was aborted: Could not create SSL / TLS secure channel."}. What is the possible reason?
|
|
|
|
|
You have posted a fair bit here about this API. I would suggest that you would be better off seeking answers from the support forums at vk.com. You also never seem to show code. Here's a hint, we can't read minds so we don't know what's wrong with your code.
|
|
|
|
|
tfile101 wrote: What is the possible reason?
An invalid certficate?
Bastard Programmer from Hell
|
|
|
|
|
Hi all,
I have some COM components(activex control without wrapper), which are added at runtime. I met with some problem on latebound call to some properties.
for example, a "Picture" property. I can manage to set a stdole.ipicturedisp by this way:
host.GetType().InvokeMember("Picture", BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty, null, host, new object[] { value });
this works witout any problem when value is not null. but when i need to clean the picture by passing value as null, i got a
system.reflection.targetinvocationexception.
everything works if i don't use lateboud, i.e.
host.Picture=null;
any idea on fixing this problem?
thanks in advance..
|
|
|
|
|
Try to pass something like IntPtr.Zero in the place where you are passing null.
Basically, if your com object expects a ref type of variable, it will not be able to accept a null.
You could also create a dummy variable, assign it and then pass it to the com method.
|
|
|
|
|
I tried IntPtr, but it still not work
object value = IntPtr.Zero;
host.GetType().InvokeMember(_Name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty
, null, host, new object[] { value });
System.Reflection.TargetInvocationException
Message=""
Source="mscorlib"
StackTrace:
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
Host.Net.AxPictureTest.ClearPicture(Object target)
|
|
|
|
|
How to enable the system managed size of virtual memory using WMI in C#?Kindly help me out how to proceed with it.
|
|
|
|
|
I am using the entity framework to retrieve data from a database. I pull a collection of objects and bind them to textboxes. The problem I am having is when I try to edit the textbox that is bound to an integer field. Any changes I make to the textbox are changed back to the original value when the textbox is exited. Anyone have a solution to this, beside changing all my database columns to varchar?
|
|
|
|
|
You could try to create a custom UserControl that has a TextBox and a bindable property[^] on it to translate the the textbox.Text field into an integer:
[System.ComponentModel.DefaultBindingProperty("NumericText")]
public partial class NumericTextBox : UserControl
{
public NumericTextBox ()
{
InitializeComponent ();
}
public int NumericText
{
get { return Convert.ToInt32(this.textbox1.Text); }
set { this.textbox1.Text = value.ToString(); }
}
}
Jack of all trades ~ Master of none.
|
|
|
|
|
OK, tried that and it still did not work. I do have some details though. It seems that when I exit the textbox, the attribute from the ObjectContext is going to the "get" instead of the "set", so it just returns the original value.
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
[DataMemberAttribute()]
public Nullable Discount
{
get
{
return _Discount;
}
set
{
OnDiscountChanging(value);
ReportPropertyChanging("Discount");
_Discount = StructuralObject.SetValidValue(value);
ReportPropertyChanged("Discount");
OnDiscountChanged();
}
}
private Nullable _Discount;
partial void OnDiscountChanging(Nullable value);
partial void OnDiscountChanged();
|
|
|
|
|
I wonder if it would help to cast the value or specify the underlying type of the Nullable object:
private Nullable<Int32> _Discount;
Jack of all trades ~ Master of none.
|
|
|
|
|
Hi,
May I have some fresh eyes please?
Under a Windows service running as LocalSystem, on a 60 second timed interval, I am running the following:
Process Ns = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo("netstat");
startInfo.Arguments = "-ano";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.CreateNoWindow = true;
Ns.StartInfo = startInfo;
Ns.Start();
Ns.WaitForExit();
for (int i = 0; i < 4; i++)
Ns.StandardOutput.ReadLine();
while (true)
{
string Line = (Ns.StandardOutput.ReadLine());
if (!string.IsNullOrEmpty(Line))
{
Line = Line.Trim();
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(" ", " ");
Line = Line.Replace(":", " ");
Line = Line.Replace('\r', ' ');
Line = Line.Replace('\n', ' ');
string[] s = Line.Split(' ')
if (s.Length == 7)
{
insns.Parameters["@Protocol"].Value = s[0];
insns.Parameters["@LocalHost"].Value = s[1];
insns.Parameters["@LocalPort"].Value = s[2];
insns.Parameters["@RemoteHost"].Value = s[3];
insns.Parameters["@RemotePort"].Value = s[4];
insns.Parameters["@State"].Value = s[5];
insns.Parameters["@PID"].Value = s[6];
}
else
{
insns.Parameters["@Protocol"].Value = s[0];
insns.Parameters["@LocalHost"].Value = s[1];
insns.Parameters["@LocalPort"].Value = s[2];
insns.Parameters["@RemoteHost"].Value = s[3];
insns.Parameters["@RemotePort"].Value = s[4];
insns.Parameters["@State"].Value = "0";
insns.Parameters["@PID"].Value = s[5];
}
if (Line == null)
break;
}
Ns.Close();
Ns.Dispose();
however, for no obvious reason, sometimes after only a few minutes of running or sometimes after many hours I get an exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
Can I track which index this is and 'On Error Resume Next' around it? How can I negate this error or dispose of it and continue?
It doesn't matter too much if in one cycle I only get 71 instead of 72 connections dispalayed as, 1 minute later. I collect them all again anyway.
The problem it causes is that the netstat does quit and stays running in the Task Manager which means that all subsequent netstats start piling up behind it and, although the data gets written to the db, I can end up with dozens of netstats in my Task Manager which then have to be End-Tasked.
I am fairly sure that this is because the netstat never gets to .Close & .Dispose thus never receives an Exit signal so the .WaitForExit stays waiting. I am right in this assumption? How can I send it an Exit signal after the exception is called?
Any ideas please?
|
|
|
|