Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Install Windows OS On selected IP's In a Network Pin
Dave Kreskowiak5-Apr-15 3:58
mveDave Kreskowiak5-Apr-15 3:58 
GeneralRe: How to Install Windows OS On selected IP's In a Network Pin
OriginalGriff5-Apr-15 5:39
mveOriginalGriff5-Apr-15 5:39 
GeneralRe: How to Install Windows OS On selected IP's In a Network Pin
Dave Kreskowiak5-Apr-15 5:43
mveDave Kreskowiak5-Apr-15 5:43 
GeneralRe: How to Install Windows OS On selected IP's In a Network Pin
OriginalGriff5-Apr-15 5:57
mveOriginalGriff5-Apr-15 5:57 
QuestionHow to extract XMLElement of selectedItem of ListBox in WPF? Pin
ShanmugaKS4-Apr-15 12:18
ShanmugaKS4-Apr-15 12:18 
AnswerRe: How to extract XMLElement of selectedItem of ListBox in WPF? Pin
Richard Deeming7-Apr-15 2:18
mveRichard Deeming7-Apr-15 2:18 
QuestionSelect element from a List<> Pin
DPaul19944-Apr-15 8:38
DPaul19944-Apr-15 8:38 
AnswerRe: Select element from a List<> Pin
BillWoodruff4-Apr-15 9:30
professionalBillWoodruff4-Apr-15 9:30 
If you want to select one row each time button2 is clicked, and move through the rows in order:
C#
private List<int> coada = new List<int>(26);

private currentIdi = 0;

// in button1 EventHandler code
if(coada.Count < 27) coada.add(idintrebare);

// in button2 EventHandler code
// good idea to show a MessageBox asking user if the really want to quit the app ?
if(currentIdi == coada.Count || currentIdi == 25) Application.Exit; // reached end of questions ?

currentIdi++;  // increment access pointer

selectCoada(coada[currentIdi]);

// selectCoada: get rid of the 'for/'foreach loops
private void selectCoada(int idi)
{
    // the code you use to fill the TextBoxes now
    using (Conexiune.getConnection())
    {
        string select = "SELECT DISTINCT * FROM questions WHERE id = '" + idi + "' LIMIT 1";
        // the rest of the code ...
    }
}

Comment: I think it's always a good idea to disable Controls when their use would cause an error, or when their use is irrelevant because the app is "not ready" to handle them. You might think about disabling 'button2 until clicking on it really can do something without an error.
«To kill an error's as good a service, sometimes better than, establishing new truth or fact.» Charles Darwin in "Prospero's Precepts"

GeneralRe: Select element from a List<> Pin
DPaul19944-Apr-15 10:38
DPaul19944-Apr-15 10:38 
GeneralRe: Select element from a List<> Pin
DPaul19944-Apr-15 10:45
DPaul19944-Apr-15 10:45 
GeneralRe: Select element from a List<> Pin
DPaul19944-Apr-15 11:14
DPaul19944-Apr-15 11:14 
GeneralRe: Select element from a List<> Pin
BillWoodruff4-Apr-15 11:17
professionalBillWoodruff4-Apr-15 11:17 
GeneralRe: Select element from a List<> Pin
DPaul19945-Apr-15 0:48
DPaul19945-Apr-15 0:48 
GeneralRe: Select element from a List<> Pin
BillWoodruff5-Apr-15 1:48
professionalBillWoodruff5-Apr-15 1:48 
GeneralRe: Select element from a List<> Pin
DPaul19945-Apr-15 3:08
DPaul19945-Apr-15 3:08 
GeneralRe: Select element from a List<> Pin
BillWoodruff5-Apr-15 10:12
professionalBillWoodruff5-Apr-15 10:12 
GeneralRe: Select element from a List<> Pin
DPaul19945-Apr-15 10:16
DPaul19945-Apr-15 10:16 
SuggestionRe: Select element from a List<> Pin
Richard Deeming7-Apr-15 2:21
mveRichard Deeming7-Apr-15 2:21 
GeneralRe: Select element from a List<> Pin
DPaul19947-Apr-15 6:43
DPaul19947-Apr-15 6:43 
Questionneed to order a file in stream read and write c# Pin
Member 115700984-Apr-15 7:31
Member 115700984-Apr-15 7:31 
AnswerRe: need to order a file in stream read and write c# Pin
PIEBALDconsult4-Apr-15 8:03
mvePIEBALDconsult4-Apr-15 8:03 
GeneralRe: need to order a file in stream read and write c# Pin
Member 115700984-Apr-15 8:26
Member 115700984-Apr-15 8:26 
QuestionC# class constructor best practice ? Pin
BillWoodruff4-Apr-15 5:05
professionalBillWoodruff4-Apr-15 5:05 
GeneralRe: C# class constructor best practice ? Pin
PIEBALDconsult4-Apr-15 5:52
mvePIEBALDconsult4-Apr-15 5:52 
GeneralRe: C# class constructor best practice ? Pin
BillWoodruff4-Apr-15 8:21
professionalBillWoodruff4-Apr-15 8:21 

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.