|
Hi all
I’m having 2 problems in C# now.
1. I have a MDIParent form which loads the login form in the form_load event. From there I if the user login successfully, I want to enable all menu items on the menu bar. If the login is fail, I want to disable some menu items there too. This means I want to enable/disable a MdiParent’s element from a child form, please help me how to do that.
2. From question 1, when I want to open a form from the menu, I create an object then just show it like this.
frmCustomer frmCus=new frmCustomer();
frmCus.MdiParent=this;
frmCus.Show();
But the problem is while a Customer form is opening, when the Customer menu is clicked, it creates another Customer form for me. Is there any way to check weather the form is shown or not before showing it?
|
|
|
|
|
You need to pass the current instance of your parent form to the LoginForm. This way:
LoginForm frmLogin = new LoginForm(this);
While the constructor for LoginForm will be:
public LoginForm(MDIparent frmParent)
{
this.Parent=frmParent;
}
This way you will be able to access all the controls of the parent form.
For your second problem, Application.OpenForms collection is there to help you. If the CustomerForm is already in the collection, just set Focus to it, otherwise create a new instance of it and show.
|
|
|
|
|
Thank you for your quick reply. It's very helpful for me, but can you give me more where to put Application.OpenForms in?
|
|
|
|
|
Inside the CustomerMenu click event.
ClickEvent:
if CustomerForm is open:
just set the focus on it
else:
Create it
End
|
|
|
|
|
I got it, thank you very much.
|
|
|
|
|
How to delete the URL from cache entry in c#?
While navigating in IE, consider You had open
(1) http://www.google.co.in/ in the browser(IE)
and then You had opened gmail account
(2) https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fhl%3Den%26tab%3Dwm%26ui%3Dhtml%26zy%3Dl&bsv=zpwhtygjntrz&scc=1<mpl=default<mplcache=2&hl=en
and then consider You had opened
(3) http://in.yahoo.com/?p=us
in same window.
After all, If you the generally click the back button when (3) is opened, it navigates to gmail account (i.e., (2) ),
but I want the navigation should be done from (3) to (1) by clicking 'back' button.
How can I achieve this,
If I delete the URLCacheEntry, can it be achieved?
I have to do this in c#,
So I i imported the WinInet funtion from http://msdn.microsoft.com/en-us/library/aa383983(VS.85).aspx
it doesn't show any effect,
Is there any other way to achieve this?
|
|
|
|
|
help me to validate DataGridView coloumn to take only float values.
|
|
|
|
|
You mean the user can enter only numeric value cannot enter text ?
|
|
|
|
|
yes,column should allow user to enter only float values.
|
|
|
|
|
I am using the C# API to insert a xml file which is having schemaLocation attribute in it.
from the database side, we are using ODP.Net provider for oracle 10g.
ODP.Net is having full support in case of xml native functionalities and we are using non-structured xml type of storage.
Problem:
"Open cursors exceeded" exception is coming when importing more than 300 xml files into xmltype(Oracle) field with ODP.Net provider(Oracle.DataAccess.dll) using the relevant C# API for that.(I have Disposed all the resources using here).
here is the sample code:
string strFileContents = strXmlRecordContent;
if (Conn == null)
{
Conn = new Oracle.DataAccess.Client.OracleConnection(CatalogueDbConnection.ConnectionString);
}
if (Conn.State != ConnectionState.Open)
{
Conn.Open();
}
Oracle.DataAccess.Client.OracleCommand cmdInsertXmlRec = new Oracle.DataAccess.Client.OracleCommand();
cmdInsertXmlRec.Connection = Conn;
cmdInsertXmlRec.CommandText = "INSERT INTO XMLRecord (MetadataID,XMLData) VALUES(:Metadataid,:strFileContents ) ";
cmdInsertXmlRec.Parameters.Add(":Metadataid", Oracle.DataAccess.Client.OracleDbType.Int32).Value = MetadataID;
OracleXmlType Text = new OracleXmlType(Conn, doc);
cmdInsertXmlRec.Parameters.Add(":strFileContents", Oracle.DataAccess.Client.OracleDbType.XmlType).Value = Text;
cmdInsertXmlRec.ExecuteNonQuery();
if (cmdInsertXmlRec != null)
cmdInsertXmlRec.Dispose();
one main observation: cursors are opened if the xml file is having schemaLoaction attribute in it.
|
|
|
|
|
Hello. I was wondering, Im working on a TCP Server. How would I do the follow?
1.) When a client types something in the console, and its sent to the server, how would I parse that and do like an if(data == "hello") { blah blah }. How would I be able to parse the recieved string. If someone could help me I would GREATLY appreciate it. Here is my current server:
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
public class UdpSrvrSample
{
public static void Main()
{
byte[] data = new byte[1024];
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 7557);
UdpClient newsock = new UdpClient(ipep);
Console.WriteLine("Waiting for a client...");
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
data = newsock.Receive(ref sender);
Console.WriteLine("Connection received from {0}", sender.ToString());
string welcome = "OpticVPS Remote Administration";
data = Encoding.ASCII.GetBytes(welcome);
newsock.Send(data, data.Length, sender);
while (true)
{
data = newsock.Receive(ref sender);
Console.WriteLine(Encoding.ASCII.GetString(data, 0, data.Length));
newsock.Send(data, data.Length, sender);
}
}
}
[X] 100% HTML
[ ] 100% PHP
[ ] 100% C#
|
|
|
|
|
Seriously?
The snippet you posted shows you how to make a string from a byte array.
|
|
|
|
|
Hi all,
How can I check for past or future date. I've a DateTime value and I want to know it's either past date or a future date from the current DateTime. Can you someone help me to do this.
Thanks.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
I've found the solution. Comapre method do all what I want. Thanks for looking into my question and sorry for disturbing here.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
The system is deployed on the user PC,as the usual time it runs under the user mode,once I click some menu(or button),
the system runs under the developing mode, at this moment, the programmer can redesign the system, for example,
add some buttons on the winform, and encode the code and recomplie it.
Could you please give me some suggestion or some codes for it?
Many thanks
|
|
|
|
|
Are you asking about how to write a system where the end user can redesign the UI ? If not, I have no idea what you're saying.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
yes, I want to it can be redesigned the UI without the VS.net envirnment.
Do you have any idea about it ?thanks!
|
|
|
|
|
You need to define your own format to create UI elements, and to define what they do, then write a program which can read that format, and one that writes it. You may use an xml document, for example. It's far from trivial. Creating UI is easy enough, especially if you limit it to a few types of elements, the question is, how do you define what the UI elements actually DO ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
Christian Graus,Thanks for your kind help,If you know some simple examples for reference,I am very grateful!
|
|
|
|
|
Have a read through the articles on Marc Clifton's blog[^] (or here in Code Project), paying particular attention to his articles on Declarative Programming.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
If your users are WPF-tolerant, then you can use the XamlReader[^] class like they did in this thread on the MSDN forums
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
|
I've searched for some component examples but I couldn't find what I want, it seems to be simple but i'm getting few issues to develop it.
What I would like to have is a custom component inherited from a textbox and also add a Label at runtime. so, everytime I drag & drop the textbox from the toolbox to the form it comes with a label, if i move the textboxcontrol or the label, they all move together.
Is it possible to do it instead of creating a usercontrol?
Thanks in advance!
|
|
|
|
|
Yeah, write the entire thing inheriting from Control instead.
Is there is a way to do it without creating your own control?? Nope.
|
|
|
|
|
I am working on a ultra light database for .NET.
I target small programs where using in memory datatable would be wasting too much memory but using SQL Express would require a too big install.
It could be for example used for example :
- by a client application that want to cache data coming from the server
- by a small programs like a little mp3 library, custom webbrowser to store bookmarks or a list of cached files.
It has a few features that might of interest:
- Very low memory footprint
- Very compact (45 Kb so far)
- Very fast (having no transaction support, no multi-threading support has its benefit)
- Automatic caching mechanism
- Work with garbage collector
- Supports DBF format
- Supports DBF index
There is a little demo program.
I wondered if some of you could have a look.
The program shows you a table of individuals.
The menu let you add 100 random individuals.
The index support is not really implemented well.
Once you have a few hundread you can click on the header to sort by that column, the index is created only once however, I haven't written the BTREE index deletion/update yet.
http://dbfdotnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28087[^]
|
|
|
|