Click here to Skip to main content
15,884,099 members
Home / Discussions / C#
   

C#

 
QuestionHow to make connection with SQL Server on another computer? Pin
Alex Dunlop17-Dec-20 9:14
Alex Dunlop17-Dec-20 9:14 
AnswerRe: How to make connection with SQL Server on another computer? Pin
BabyYoda17-Dec-20 9:20
BabyYoda17-Dec-20 9:20 
AnswerRe: How to make connection with SQL Server on another computer? Pin
DerekT-P17-Dec-20 10:16
professionalDerekT-P17-Dec-20 10:16 
QuestionComboBoxItem in another Form Pin
AnissGharib4917-Dec-20 2:09
AnissGharib4917-Dec-20 2:09 
AnswerRe: ComboBoxItem in another Form Pin
Dave Kreskowiak17-Dec-20 3:56
mveDave Kreskowiak17-Dec-20 3:56 
AnswerRe: ComboBoxItem in another Form Pin
OriginalGriff17-Dec-20 4:40
mveOriginalGriff17-Dec-20 4:40 
AnswerRe: ComboBoxItem in another Form Pin
Gerry Schmitz17-Dec-20 4:48
mveGerry Schmitz17-Dec-20 4:48 
AnswerRe: ComboBoxItem in another Form Pin
Herboren18-Dec-20 10:55
Herboren18-Dec-20 10:55 
The Form is a container for controls, so you cannot access it directly from another form/class especially when controls have private modifiers. Using access modifiers may still cause some issues. Its better to access the control using Controls class.

C#
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            comboBox1.Items.Add("Combo Item");
        }
    }

    public class GetComboItem
    {
        public GetComboItem()
        {
            ComboBox cmbItm = Application.OpenForms["Form1"].Controls.Find("comboBox1", true)[0] as ComboBox;            
            MessageBox.Show(cmbItm.Text);
        }
    }

QuestionBecoming functional: adding Option of T to List when IsSome only Pin
Bernhard Hiller13-Dec-20 22:55
Bernhard Hiller13-Dec-20 22:55 
AnswerRe: Becoming functional: adding Option of T to List when IsSome only Pin
Richard Deeming14-Dec-20 0:41
mveRichard Deeming14-Dec-20 0:41 
GeneralRe: Becoming functional: adding Option of T to List when IsSome only Pin
Bernhard Hiller14-Dec-20 2:40
Bernhard Hiller14-Dec-20 2:40 
Questionc# programing Pin
toori shabab9-Dec-20 3:50
toori shabab9-Dec-20 3:50 
AnswerRe: c# programing Pin
Richard Deeming9-Dec-20 3:53
mveRichard Deeming9-Dec-20 3:53 
AnswerRe: c# programing Pin
OriginalGriff9-Dec-20 4:28
mveOriginalGriff9-Dec-20 4:28 
JokeRe: c# programing Pin
CHill609-Dec-20 5:11
mveCHill609-Dec-20 5:11 
GeneralRe: c# programing Pin
OriginalGriff9-Dec-20 5:20
mveOriginalGriff9-Dec-20 5:20 
GeneralRe: c# programing Pin
CHill609-Dec-20 6:00
mveCHill609-Dec-20 6:00 
AnswerRe: c# programing Pin
Gerry Schmitz9-Dec-20 5:48
mveGerry Schmitz9-Dec-20 5:48 
AnswerRe: c# programing Pin
Pete O'Hanlon9-Dec-20 21:52
mvePete O'Hanlon9-Dec-20 21:52 
QuestionSend GMail Pin
Kevin Marois7-Dec-20 16:41
professionalKevin Marois7-Dec-20 16:41 
AnswerRe: Send GMail Pin
OriginalGriff7-Dec-20 21:04
mveOriginalGriff7-Dec-20 21:04 
AnswerRe: Send GMail Pin
Richard Deeming7-Dec-20 21:55
mveRichard Deeming7-Dec-20 21:55 
Questionc# language issue: when you need to serialize/deserialize a user defined Func/Action Pin
BillWoodruff7-Dec-20 2:40
professionalBillWoodruff7-Dec-20 2:40 
QuestionPlatform dependency of thread management Pin
Bernhard Hiller6-Dec-20 23:30
Bernhard Hiller6-Dec-20 23:30 
AnswerRe: Platform dependency of thread management Pin
Dave Kreskowiak7-Dec-20 3:59
mveDave Kreskowiak7-Dec-20 3:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.