|
While using this tutorial, ia have problem in the following code
if (Application.OpenForms.Count > 1)
as error occur that 'System.Windows.Forms.Application' does not contain a definition for 'OpenForms'
Can You please solve my problem
Mandeep
Email: cheers_man2003@yahoo.co.in
|
|
|
|
|
Well - it would seem to me that you have three problems:
1. The error tells you that Application doesn't have a definition for OpenForms.
2. I have no idea where this tutorial is.
3. Questions like this should be asked of the author.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete is correct. But, I can tell you that it sounds like you've stumbled acrossed code written for the .NET Framework 2.0 and above, and you're using .NET 1.1 or below. The Application.OpenForms property didn't show up until .NET 2.0.
|
|
|
|
|
hi
Thanks for reply.
I am using .NET 2003 version. if that event is not available in this version , then please solve my problem by giving me other alternative that I can use in its place.
Mandeep
Email: cheers_man2003@yahoo.co.in
|
|
|
|
|
That's not an event. It's a property that exposes a collection.
There is no equivilent in .NET 1.x. Since all you did was say that this particular line gave you a problem, I can't give you an alternative to anything. You haven't described what the goal of using this code it.
If what you're looking for is something that shows you how to up a Splash screen, then all you need to do is Google for "VB.NET .NET 1.1 Splash Screen".
|
|
|
|
|
Forgive the 'generic' formatting, I don't seem to be able to post 'proper' generic code here.
I have a simple class (see below). I need to have a way to have a SINGLE collection of 'GenericDataElement' objects.
Is this possible? Some of the items may be GenericDataElement<<string>> , while others may be GenericDataElement<<int>>.
public class GenericDataElement<<T>> <br />
{<br />
private string name;<br />
private T value;<br />
<br />
<br />
public string Name<br />
{<br />
get { return name; }<br />
}<br />
<br />
public T Value<br />
{<br />
get { return value; }<br />
}<br />
<br />
public GenericDataElement(string name, T value)<br />
{<br />
this.name = name;<br />
this.value = value;<br />
}<br />
<br />
}
|
|
|
|
|
It isn't possible to have a strongly typed generic list that allows 2 different type parameters, but you can do something like that:
public class GenericDataElement
{
}
public class GenericDataElement<T> : GenericDataElement
{
public GenericDataElement(string name, T value)
{
this.name = name;
this.value = value;
}
private string name;
public string Name
{
get { return name; }
}
private T value;
public T Value
{
get { return value; }
}
}
public class Test
{
List<GenericDataElement> list = new List<GenericDataElement>();
public void TestIt()
{
list.Add(new GenericDataElement<string>("string", "value"));
list.Add(new GenericDataElement<int>("int", 1));
foreach (GenericDataElement gde in list)
{
if (gde is GenericDataElement<int>)
Console.WriteLine("int");
else
Console.WriteLine("string");
}
}
}
But you will have an untyped collection, of course.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Hy,
I have the following code put in the protected override OnKeyDown to a RichTextBox:
switch (e.KeyCode)
{
case Keys.Tab:
case Keys.Enter:
{
autocomplete(_defaultColor);
e.Handled = true;
break;
}
}
and the autocomplete method:
private void autocomplete(Color defaultColor)
{
for (int i = 0; i < 1; i++)
{
SendKeys.SendWait("{BACKSPACE}");
}
SendKeys.SendWait("public");
}
1.Run the application and press "p" then press ENTER.
2.Run the application and press "p" then press TAB.
In both cases the effect is different but is the same code for both cases.
Can somebody give me an explication?
-- modified at 8:58 Tuesday 9th October, 2007
|
|
|
|
|
Hi,
unless you set KeyEventArgs.SuppressKeyPress true, there will be a KeyPress event,
which will act differently for ENTER and TAB.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello Luc,
Luc Pattyn wrote: set KeyEventArgs.SuppressKeyPress true
very interesting!
Do you also know a .Net 1.1 solution for that problem?
All the best,
Martin
|
|
|
|
|
Hi Martin,
sorry I don't know a replacement for KeyEventArgs.SuppressKeyPress other than adding
specific code in one or both event handlers.
I stopped using .NET 1.x completely.
Greetings,
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello Luc,
But isn't there allways the problem, that the "Tab" leeds to loosing the Focus of the Control?
Luc Pattyn wrote: I stopped using .NET 1.x completely.
Oh no!
The last one (apart from me) left the ship!
All the best,
Martin
|
|
|
|
|
Martin# wrote: But isn't there allways the problem, that the "Tab" leeds to loosing the Focus of the Control?
There was and is a solution to these by using one of Control.IsInputChar
and Control.ProcessCmdKey
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Excellent!
All the best,
Martin
|
|
|
|
|
According to Microsoft compressed folders in windows uses the following .dlls
1) Dunzip32.dll: Responsible for decompressing files stored in a compressed folder or file when they are copied, extracted, or executed.
2) Dzip32.dll: Responsible for compressing files when they are put into a compressed folder or file.
I need these dlls for a Console project that directly uses them to compress and decompress .zip files.
But when i try to add any of the above dll's as a reference to my project in Visual Studio 2005 i get the ERROR: Reference could not be added. Please make sure that the file is accessible and that it is a valid assembly or COM object.
Can anybody help me ???
================================
Thanks();
|
|
|
|
|
You cannot add them as references because they are written in unmanaged code, so you need to import the methods from those libraries using the DllImport attribute.
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Thanks a lot.
But I think by using System.IO.Compression the same functionality of Dunzip32.dll can be achieved.
================================
Wirth's law: Software gets slower faster than hardware gets faster.
|
|
|
|
|
JSSUML wrote: Can anybody help me ???
Instead of trying to use these DLLs directly. Why not have a look in the System.IO.Compression[^] namespace for managed classes that do the same work.
|
|
|
|
|
Thanks. that works well
================================
Wirth's law: Software gets slower faster than hardware gets faster.
|
|
|
|
|
Hi all,
I am having an error and an doubt.
In my applicaiton i am sending automatic mail. In that whn i use
SmtpMail.SmtpServer = " localhost" , there is no issue for me. But while using the
SmtpMail.SmtpServer = " smtp.your-server.com" , mail is not sending/reciving for me. I got the sample from some other forums.
Plz some one explaion wht is the problem, and how to solve i. Also suggest me in which suitation i have to use localhost and hich suitation i have to use smtp.servername.com.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
First check to see if the "smtp.your-server.com" is reachable from your workstation.
Try ping smtp.your-server.com from command prompt.
If it does not suceed that means there is no direct connection to smtp.your-server.com and you will probably have to use a relay server to send your mail.
================================
Thanks();
|
|
|
|
|
Hi,
while tranporting from eccel file to datatable all the fields are coming correctly except one field which is not coming if it is having numbers, if it is having string than it also coming correctly.
while other columns are coming correctly in all the cases either it is having string or numbers.
Thanks in advance,
Vijay Kumar
Software Engineer
|
|
|
|
|
Have you fixed this yet?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
foreach(DataRow dr in dataset.Tables["principal"].Rows)<br />
{<br />
if (dr["name"].ToString()==szPrincipal_name)<br />
{<br />
nPrincipal_Id = Convert.ToInt32(dr["principal_Id"].ToString());<br />
bEncontrou = true;<br />
break;<br />
}<br />
nPrincipal_Id++;<br />
}
_labelRowDeleted:<br />
foreach (DataRow myRow in dataset.Tables["grant"].Rows)<br />
{<br />
if (myRow["principal_Id"].ToString() == nPrincipal_Id.ToString())<br />
{<br />
myRow.Delete();<br />
goto _labelRowDeleted;<br />
}<br />
}
Solutions are welcome.
|
|
|
|
|
How about this?
bool finished = false;
while (!finished)
{
try
{
foreach (DataRow myRow in dataset.Tables["grant"].Rows)
{
if (myRow["principal_Id"].ToString() == nPrincipal_Id.ToString())
{
myRow.Delete();
throw new Exception();
}
}
finished = true;
}
catch
{
finished = false;
}
}
Just an ideea
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|