C# Programing FAQ - Post here

Ranhiru

Member
Feb 2, 2007
6,438
42
0
Inside FIREFOX
chindaara said:
macho,
i have a database in my application (.mdf database)
i want to backup my my data on button click and retrieve data on button2 click.i/m using gridviews to enter,view,update details.
plz help me


You want to backup to another database? Or?? Please explain your backup strategy
 

asachan

Member
Apr 11, 2009
1,636
3
0
Athurugiriya
Ranhiru said:
You want to backup to another database? Or?? Please explain your backup strategy

I think he's not talking about backing up the data man
he's talking about saving the data on the Dgrid when Btn click and Retrieve Records on another BTN Click

hehehehe i can add the codes man but you reply him right . so it's your call friend
 

asachan

Member
Apr 11, 2009
1,636
3
0
Athurugiriya
Ranhiru said:
Im doing a small project... and from the Main Menu.. i want to show another Form..
so i call this


Code:
 private void btnCustomer_Click(object sender, EventArgs e)
         {
                          
             frmCustomer fCus = new frmCustomer();

                       
             fCus.Show();
                          

             
         }
Now the problem is each time the user presses the Customer button, a new instance of the Form is created!! :( :(

How to prevent this??? Please help!


Correction
======
First of all your Form instance call is not complete
it should be like this

frmCustomer fCus = new frmCustomer();
fCus.Activate();
fCus.Show();

Now it's complete and the form will be activated and windows handles will be created properly. without activate() , form never receive the forces . and if some other program runs as "Top owner level in User Mode" in windows , your form will not create handles to the User windows Mode in Kernel.


Solution to your question man
===================

First you have to look that the given form instance is already in the Heap(U know what is heap right?) . so how can we do it?

1. getting all active forms on the Application

FormCollection frms = Application.OpenForms;

2. loop through forms and see if our form is in the collection

bool formAvailable = false;

foreach (Form frm in frms)
{
if (frm.Name.Trim().ToUpper() == "frm_allCosting".ToUpper())
{
formAvailable = true;
}
}

if(formAvailable == true){
//this means ur form already run and give a message to uer
}



NOTE: "frm_allCosting" is the name of the form you need to look at

Hope this will help you man . good luck
 

asachan

Member
Apr 11, 2009
1,636
3
0
Athurugiriya
Jack_Sparrow said:
Machan C# wala windows applications gena karamuda?

Machan u have to learn it on some level
and then we can help you from there for sure.

First of all look in to followings

1. Dot net Framework
2. Understand CLR
3. Understand CTS (Common type system)
4. poor knowledge about object orientation will be good(Very poor knowledge will be enough )

then the only way to learn a programing language is to give a solutions to a real world problem using C# or that language. and you will be learn it very very quickly than a ordinary class.

If you have a currage to self learning , i am here to help
 

gayancc

Active member
  • Sep 8, 2007
    3,357
    8
    38
    my lap
    machan mouseenter event eken mama form eke opacity wenas kalama form eka ethule add karala thiyena button,lables walata ewa weda karanne ne give me the solution
     

    asachan

    Member
    Apr 11, 2009
    1,636
    3
    0
    Athurugiriya
    gayancc said:
    machan mouseenter event eken mama form eke opacity wenas kalama form eka ethule add karala thiyena button,lables walata ewa weda karanne ne give me the solution

    Give me more details man

    Note: if you are in a MDI interface and you set Opasity level in a MDI child it wont workkkkkkkkkkkkkk hehehe. that's the poorness of Microsoft and we can't do nothing.

    but if you not in MDI interface and you set opasity to low it will sure give transparent effect . no matter what control you put in to , it will give you transparant effect nicely.

    and if you want to control it. ask Microsoft to give it in next release hehehehe

    Hope this will help you man good luck
     

    chindaara

    Member
    Aug 9, 2007
    505
    1
    0
    මහරගම
    Ranhiru said:
    You want to backup to another database? Or?? Please explain your backup strategy

    i hav a database which hav 5 tables in it.i want to backup those table data into microsoft excel spreadsheet on a button click.that means when i press "backup" button an excel file will create and all the data of my .mdf database will be stored there as tables.
     

    gayancc

    Active member
  • Sep 8, 2007
    3,357
    8
    38
    my lap
    asachan said:
    Give me more details man

    Note: if you are in a MDI interface and you set Opasity level in a MDI child it wont workkkkkkkkkkkkkk hehehe. that's the poorness of Microsoft and we can't do nothing.

    but if you not in MDI interface and you set opasity to low it will sure give transparent effect . no matter what control you put in to , it will give you transparant effect nicely.

    and if you want to control it. ask Microsoft to give it in next release hehehehe

    Hope this will help you man good luck

    no machan u ddnt gt tht my problem i used mouse enter event for set opacity=1 and mouse leaver event for set opacity=0.5 but when i used mouse enter event and mouse leaver event on my form it only works on particular form it does not work for button and lable for the same form please help me...
     

    asachan

    Member
    Apr 11, 2009
    1,636
    3
    0
    Athurugiriya
    gayancc said:
    no machan u ddnt gt tht my problem i used mouse enter event for set opacity=1 and mouse leaver event for set opacity=0.5 but when i used mouse enter event and mouse leaver event on my form it only works on particular form it does not work for button and lable for the same form please help me...

    I get it
    Machan that's cos you only put your Mouse Enter event for the visible parts of the form man. when form has a control on it , the control covers the Form's visible part so when you mouse over that control form's Mouse Over event never raise and your opacity translations wont work.

    One way to do this is override control's Mouse events. because windows from controls have independent Mouse event controls .

    let me have some time and may be i can find a way to thi
     

    Jack_Sparrow

    Well-known member
  • Jun 16, 2008
    42,522
    1
    16,927
    113
    Black Pearl
    asachan said:
    Machan u have to learn it on some level
    and then we can help you from there for sure.

    First of all look in to followings

    1. Dot net Framework
    2. Understand CLR
    3. Understand CTS (Common type system)
    4. poor knowledge about object orientation will be good(Very poor knowledge will be enough )

    then the only way to learn a programing language is to give a solutions to a real world problem using C# or that language. and you will be learn it very very quickly than a ordinary class.

    If you have a currage to self learning , i am here to help


    heh thanks mate ,
    i know only little about C#, upto basics object oriented
    do you have any tutes on C# windows app development ?
     

    asachan

    Member
    Apr 11, 2009
    1,636
    3
    0
    Athurugiriya
    00gayan00 said:
    Machoooooooooooo

    Id also like to learn abt C++/ C#/Java or wateva programmin
    I also know abt Visual Basic (very little, only upto OL knowledge)

    So guys can u plzzz tell me which language is easier to start
    and plzzzz giv me sme tutorials and E bookss machoooooooo

    Plzzz hlp me!!!!!

    First let me make some points pls

    1. C++ is a very good lang for some level of programing . i am talking here about very serious programing stuff. For instance if you know c++ very well you can join Linux Development team and can develop linux OS parts .

    2. In other hand Java is a very powerful language witch now has a top reputation of the world. Java mostly used to develop high end services like payment Getaways , High end Decision making systems or Real time Management systems.

    3. C# is a combination of all these languages. it is like Java in some ways or some code phases more like C++ and it has some features used in VB language . so basically what MS did was abstract all languages features and create this new language.

    So in Sri lanka if you take a simple application like Stock handling system . C# will be a best choice to develop it. cos c# very easy to develop this type of bussiness aplications than Java or C++. so for now i think C# will be a good choice to learn.

    I will post some good C# books here Latly today.
    cos still i have to upload it

    But if some one need it now , give me mail addresses i will send them
     

    asachan

    Member
    Apr 11, 2009
    1,636
    3
    0
    Athurugiriya
    Jack_Sparrow said:
    heh thanks mate ,
    i know only little about C#, upto basics object oriented
    do you have any tutes on C# windows app development ?

    Hey i will post my MSN SKYDRIVE Path here for C# Notes and Books
    Still i am uploading them
    So please wait
     

    asachan

    Member
    Apr 11, 2009
    1,636
    3
    0
    Athurugiriya
    You can download E-books from my MSN SkyDrive now

    http://cid-cae3b85e944c2477.skydrive.live.com/browse.aspx/C|3%20Notes%20and%20E-Books?uc=5&nl=1

    Those are for Beginners only not for advanced C# users

    I will upload some Advanced E-books for those users soon

    Also i will upload some simple Most wanted code segments Shortly