|
Luc Pattyn wrote: IMO you can't reliably design a long running .NET Windows app
Fixed that for you!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
AFAIK the fragmentation issue that exists in the .NET CLR is not fundamentally present in Windows itself, so .NET apps have one reason not to be long-lived that Windows apps don't have.
MS could alleviate the problem by adding a CompactLargeObjectHeap() method to the GC class but I don't expect them to do so any time soon.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Can you change the code? If so, just put some logging in the constructor(s) and the finalizer.
In terms of when an object gets added and removed from memory, in .NET (for reference types) it gets allocated when you new up a type prior to the constructor call. It gets removed at some indeterminate point in the future when its no longer being used by the .NET garbage collector.
Regards,
Rob Philpott.
|
|
|
|
|
Hi all,
I am trying to manage group policies programaticaly, using C#. I have searched through google from last 2 days and find nothing on it. In one forum I have found that I need to add "GPO Admin 1.0 Type Library" from COM reference into my project. But in Visual Studio 2008 (.NET framework 3.5) does not contain it.
So, right now I do not know whether I can do that or not.
All kind of relative suggestions are welcome. Thanks.
|
|
|
|
|
I've done some programming in C# when it comes to user groups and policys (but probably not the way that you're about to do..). For the user group part I used some netapi.dll methods with p/Invoke. For the policy part maybe you could check the System.Security namespace? It's been awhile since I worked with these things so you have to excuse this kinda vague answer :/ Good luck!
|
|
|
|
|
Hi Calla,
Thanks for the reply. I'll surely try the System.Security namspace.
Yesterday, I have found something interesting in MSDN. They are using scripts (JScript, VBScript or Shell Script) for managing Group Policies. But I dont know even 'S' of scripting langauges. Lets see how much I can progress in that foeld with C#.
Bye.
|
|
|
|
|
hi all, i've encountered some mistake with serial port developement.
I use the compact framework 2.0 with visual studio 2008 pro.
I've developped a simple application which do a serialprt.open() on the port COM1.
(i've tested with COM2, COM3 and COM4 too but same exception).
When I deploy the project with visual studio on my Windows Embedded CE 6.0 device all works fine.
But when i reboot the panel pc (an AFL-07A-LX) and when i try to open a COM port I have an exception :
Exception : IOException
Inner Exception : null
Stack Trace :
at System.IO.Port.SerialStream.WinIOError()
at System.IO.Port.SerialStream.CheckResult()
at System.IO.Port.SerialStream.setBufferSizes()
at System.IO.Port.SerialStream.Open()
I'm searching for the solution from 2 days and i've found nothing at all
N.B : i'm french so don't take care to my bad english.
|
|
|
|
|
I am in the same trouble,have you solved it ? if you have solved it ,can you tell me the way? thank you and my email is shineqiujuan@163.com
|
|
|
|
|
Hi,
How i can send mail to more that one person,
i've looked all over the internet and find only the option to add the Bcc (Blind carbon-copy).
Is there any other option to do so, like at the "TO"?
Thanks,
Tamir
|
|
|
|
|
treuveni wrote: i've looked all over the internet and find only the option to add the Bcc (Blind carbon-copy).
Is there any other option to do so, like at the "TO"?
The 'to' in some mail programs, just adds to the CC, which is like the BCC, except everyone can see who you mailed to.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi,
when using the MailMessage class, the properties To, Cc, and Bcc are MailAddressCollections.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Forgive me if this is too obvious, but have you tried simply semi-colon seperating the addresses you want to send to?
I.e, if you want to send an email to three people the string passed into the "TO" field would be something like "john@something.com ; bill@something.com ; ted@something.com".
Is that what you mean?
|
|
|
|
|
Ofcource...
and i received this error:
The specified string is not in the form required for an e-mail address
|
|
|
|
|
I run a c# application which returns results in the format of the following text:
Is this example below, I would like to return the text "SizeStoredInPagingFiles: 4476456"
I always need to get the last text such as the above in this sample.
"Microsoft (R) Windows Script Host Version 5.6\r\nCopyright (C) Microsoft Corporation 1996-2001. All rights reserved.\r\n\r\n-----------------------------------\r\nWin32_OperatingSystem instance\r\n-----------------------------------\r\nSizeStoredInPagingFiles: 4476456\r\n"
"Microsoft (R) Windows Script Host Version 5.6\r\nCopyright (C) Microsoft Corporation 1996-2001. All rights reserved.\r\n\r\n-----------------------------------\r\nWin32_OperatingSystem instance\r\n-----------------------------------\r\nversiontext : 2\r\n"
In the above sample I would like to return "versiontext : 2"
How do I do this please?
|
|
|
|
|
Use the substring function
himanshu
|
|
|
|
|
use Environment.NewLine to get your \r\n, and use the split method.
string[] parts = myString.Split(Environment.NewLine);
will give you an array of strings. Assuming each part you want is a full line of text, you'll have them seperated as you need. If not, use regex.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
|
Hi,
First time I am using datagridview I have some questions and problems.
Please guide me or provide solutions if possible.
I am using adapter to bind the DGV.
1. My datasource is coming through multiple tables
Exe: select a,b,c,d from t1 left outer join t2 on t1.a=t2.d
Because of that any kind of modification update, delete, insert not working
2. unable to add auto row columns
3. unable to find cells textbox property, I want to use cells textbox autocomplete property for providing help to users
<pre> private void dgCountryZone_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (dgCountryZone.Columns[this.dgCountryZone.CurrentCell.ColumnIndex].Name.Equals("Destination Code"))
{
TextBox txt = e.Control as TextBox;
txt.Multiline = false;
txt.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txt.AutoCompleteSource = AutoCompleteSource.CustomSource;
txt.AutoCompleteCustomSource = colCountryListCodeCheck;
}
}
4. in the time of validation if I am using cells current position its not work
exe: say present cell position is cell(4,5) now user press tab if validate pass then I want to set focus on cell(4,9) or else in cell(4,5) but it moves on cell(4,10) or cell(4,6)
<pre>private void dgCountryZone_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
Int32 RowCounter;
Int32 DuplicateCounter;
IDataReader idrCountryName;
DuplicateCounter = 0;
if (dgCountryZone.Columns[e.ColumnIndex].Name == "Destination Code")
{
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) != "")
{
for (RowCounter = 0; RowCounter <= dgCountryZone.Rows.Count - 1; RowCounter++)
{
if (Convert.ToString(dgCountryZone.Rows[RowCounter].Cells[e.ColumnIndex].Value) == Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value))
{
DuplicateCounter++;
}
}
if (DuplicateCounter > 1)
{
dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
MessageBox.Show(MessageResource.DuplicateRecord, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
else
{
DataAccessLayer daobj = new DataAccessLayer();
UserDataType.CountryParam CParam = new UserDataType.CountryParam();
CParam.szCountryCode = Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = "";
idrCountryName = daobj.GetHelpCountryName(CParam);
while (idrCountryName.Read())
dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = idrCountryName.GetString(0);
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value) != "")
{
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex + 1, e.RowIndex];
return;
}
else
{
MessageBox.Show(MessageResource.CodeNotFound, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
}
else
{
MessageBox.Show(MessageResource.BlankField, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
if (dgCountryZone.Columns[e.ColumnIndex].Name == "Per CWB/KG")
{
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) != "")
{
if (Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).ToUpper() != "K" && Convert.ToString(dgCountryZone.Rows[e.RowIndex].Cells[e.ColumnIndex].Value).ToUpper() != "W")
{
MessageBox.Show("Please select [W for per CWB] and [K for KG]", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
else
{
MessageBox.Show(MessageResource.BlankField, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
dgCountryZone.CurrentCell = dgCountryZone[e.ColumnIndex, e.RowIndex];
return;
}
}
}
Please suggest if I am wrong or any code help if possible
Regards
Prakash
Prakash
|
|
|
|
|
Hi,
I'd created a Custom Control using MaskedTextBox and DateTimePicker. I'd written all the required validations and it is working fine. I'd even created a CustomEventHandler by using Delegate. The Problem is when I drag this control on to a form I could not find the CustomEventHandler to raise. Here is my Code. Can anyone suggest the solution. Thanks in Advance
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace DateControl
{
public partial class UserDateControl : UserControl
{
private bool IsTrue;
private bool Err;
private string MskText;
public delegate void DateControlEventHandler();
[Category("Action"),Description("Fires when the Text Changed event Occurs!")]
public event DateControlEventHandler TextChanged;
public UserDateControl()
{
InitializeComponent();
}
protected virtual void OnTextChanged()
{
if (TextChanged != null)
{
TextChanged();
}
}
private void DTPicker_ValueChanged(object sender, EventArgs e)
{
string DTP;
if (DTPicker.Value.Day < 10)
DTP = "0" + DTPicker.Value.Day + "-";
else
DTP = DTPicker.Value.Day + "-";
if (DTPicker.Value.Month < 10)
DTP += "0" + DTPicker.Value.Month + "-";
else
DTP += DTPicker.Value.Month + "-";
DTP += DTPicker.Value.Year;
MskDateControl.Text = DTP;
}
[Category("DateControl Configuration"),Description("Whether the Control should accept more than Today's date?"),DefaultValue(false)]
public bool AcceptMoreThanToday
{
get { return IsTrue; }
set
{
IsTrue = value;
}
}
public string DateValue
{
get { return MskText; }
set
{
MskText = MskDateControl.Text;
}
}
private void MskDateControl_Validating(object sender, CancelEventArgs e)
{
if (MskDateControl.MaskFull == false)
{
errorProvider1.SetError(MskDateControl, "Please Check the Date!");
}
}
private void MskDateControl_TextChanged(object sender, EventArgs e)
{
if (MskDateControl.MaskFull == true)
{
Char[] ChrSep = new Char[] { '-' };
String[] SplitDate;
SplitDate = MskDateControl.Text.Split(ChrSep, 3);
int y = int.Parse(SplitDate.GetValue(2).ToString());
int d = int.Parse(SplitDate.GetValue(0).ToString());
int m = int.Parse(SplitDate.GetValue(1).ToString());
Err = false;
if (m > 12 || m <= 0)
{
Err = true;
errorProvider1.SetError(MskDateControl, "Please Check the Month!");
}
else if (y < 1900)
{
Err = true;
errorProvider1.SetError(MskDateControl, "Please Check the Year!");
}
else if (DateTime.DaysInMonth(y, m) < d)
{
Err = true;
errorProvider1.SetError(MskDateControl, "Please Check the Days!");
}
else if (d > 31 || d <= 0)
{
Err = true;
errorProvider1.SetError(MskDateControl, "Please Check the Days!");
}
else
{
Err = false;
errorProvider1.SetError(MskDateControl, "");
if (TextChanged != null)
{
OnTextChanged();
}
}
if (IsTrue == false && Err==false)
{
DateTime CnvDate = new DateTime(y, m, d);
DateTime SDate = DateTime.Today;
if (CnvDate > SDate)
{
errorProvider1.SetError(MskDateControl, "Date should not be more than Today's Date");
}
}
}
}
private void MskDateControl_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == ' ') e.KeyChar = (char)0;
}
private void MskDateControl_Validated(object sender, EventArgs e)
{
if (Err == false && MskDateControl.MaskFull == true)
{
Char[] ChrSep = new Char[] { '-' };
String[] SplitDate;
SplitDate = MskDateControl.Text.Split(ChrSep, 3);
int y = int.Parse(SplitDate.GetValue(2).ToString());
int d = int.Parse(SplitDate.GetValue(0).ToString());
int m = int.Parse(SplitDate.GetValue(1).ToString());
DateTime EDate = new DateTime(y, m, d);
DTPicker.Value = EDate;
DateValue = MskDateControl.Text;
}
}
}
}
Sreedhar Kadiyala
|
|
|
|
|
It appears that MS has done some fancy hiding on the original TextChanged event for a UserControl.
Firstly, you should mark the event as new so it replaces the inherited implementation then add the following two attributes to it:
[EditorBrowsable(EditorBrowsableState.Always),
Browsable(true)]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thank you very much. It worked.
Sreedhar Kadiyala
|
|
|
|
|
i need to write the codeing for QR barcode decoder. i found few sample codings but thats quite complecated....is there any easy way than this? simple way to decode a QR barcode.
Open Source QRCode Library[^]
|
|
|
|
|
S K Y wrote: need to write the codeing for QR barcode decoder. i found few sample codings but thats quite complecated....is there any easy way than this? simple way to decode a QR barcode.
Open Source QRCode Library[^]
...simpler than this? You are probably a bit lazy.
Regards: Didi Kunz
|
|
|
|
|
I have a web application and a console application. I used datetime in both the application. However I need to set the culture of the datetime by the culture of that local. I have configured the application in Itely server, it'w works fine there, however when I configured in India it shows the datetime error.
Pankaj
|
|
|
|
|
And the error looks like? Do you get an error message?
|
|
|
|
|