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

C#

 
AnswerRe: how to add an edit button on first row in gridview Pin
Richard MacCutchan5-Feb-15 22:00
mveRichard MacCutchan5-Feb-15 22:00 
QuestionECC implementation Pin
Member 114315045-Feb-15 19:14
Member 114315045-Feb-15 19:14 
AnswerRe: ECC implementation Pin
DelphiCoder5-Feb-15 20:24
DelphiCoder5-Feb-15 20:24 
Questionmultilanguage support by windows application using C# Pin
Member 114314135-Feb-15 18:58
Member 114314135-Feb-15 18:58 
AnswerRe: multilanguage support by windows application using C# Pin
V.5-Feb-15 20:15
professionalV.5-Feb-15 20:15 
QuestionTable Adapter Pin
Member 114310155-Feb-15 12:49
Member 114310155-Feb-15 12:49 
SuggestionRe: Table Adapter Pin
Richard MacCutchan5-Feb-15 21:59
mveRichard MacCutchan5-Feb-15 21:59 
QuestionReorganise algorithm Pin
sebyku5-Feb-15 11:27
sebyku5-Feb-15 11:27 
Hi, I have the following code for pressing a button in windows forms. Don`t be scared by long code, I have declared some vars and I have 2 query there. One for get first results and second is like a pagination. The problem is if I press first time on button I get some results, but if I press second time I don`t get the next results but the same. How can I change the code so if I press multiple times to get next and next results.

C#
string defaultImage;
string lang = "en";
string selectedLang = comboBox1.SelectedItem.ToString();
int Count = 5;
int maxStatuses = Convert.ToInt32(numericUpDown3.Value);
var statusList = new List();
int lastStatusCount = 0;

switch (selectedLang)
{
    case "English":
        lang = "en";
        break;
    case "Romanian":
        lang = "ro";
        break;
    case "Italian":
        lang = "it";
        break;
    case "French":
        lang = "fr";
        break;
    default:
        lang = "en";
        break;
}

var auth = apiConnect();
var twitterCtx = new TwitterContext(auth);

// last tweet processed on previous query set

var searchResponse =
    await
    (from search in twitterCtx.Search
     where search.Type == SearchType.Search &&
           search.Query == q &&
           search.Count == Count &&
           search.SinceID == sinceID &&
           search.SearchLanguage == lang &&
           search.ResultType == ResultType.Recent
     select search)
    .SingleOrDefaultAsync();

if (searchResponse != null && searchResponse.Statuses != null)
{

    List newStatuses = searchResponse.Statuses;

    maxIDlim = newStatuses.Min(status => status.StatusID) - 1;

    statusList.AddRange(newStatuses);

    do
    {
        label19.Text = maxIDlim.ToString();

        searchResponse =
            await
            (from search in twitterCtx.Search
             where search.Type == SearchType.Search &&
                   search.Query == q &&
                   search.Count == Count &&
                   search.SinceID == sinceID &&
                   search.MaxID == maxIDlim &&
                   search.SearchLanguage == lang &&
                   search.ResultType == ResultType.Recent
             select search)
            .SingleOrDefaultAsync();

        newStatuses = searchResponse.Statuses;

        maxIDlim = newStatuses.Min(status => status.StatusID) - 1;

        statusList.AddRange(newStatuses);

        lastStatusCount = newStatuses.Count;
        label18.Text = maxIDlim.ToString();
        //sinceID = maxIDlim;
    } while (lastStatusCount != 0 && statusList.Count < maxStatuses);

    listView1.BeginUpdate();
    for (int i = 0; i < statusList.Count; i++)
    {
        Status search = statusList[i];

        if (search.User.DefaultProfileImage)
            defaultImage = "NO";
        else
            defaultImage = "YES";
        string[] row = { search.User.ScreenNameResponse, search.Text, defaultImage, search.StatusID.ToString() };
        var listViewItem = new ListViewItem(row);
        listView1.Items.Add(listViewItem);
    }
    listView1.EndUpdate();
}

AnswerRe: Reorganise algorithm Pin
DelphiCoder5-Feb-15 17:24
DelphiCoder5-Feb-15 17:24 
QuestionImport C function from DLL with passing FILE stream pointer as parameter Pin
Miloš Križan5-Feb-15 9:26
Miloš Križan5-Feb-15 9:26 
AnswerRe: Import C function from DLL with passing FILE stream pointer as parameter Pin
Richard Andrew x645-Feb-15 14:41
professionalRichard Andrew x645-Feb-15 14:41 
QuestionSocket IAsyncResult - Catch SocketError Pin
sheldons5-Feb-15 8:47
sheldons5-Feb-15 8:47 
SuggestionRe: Socket IAsyncResult - Catch SocketError Pin
Richard MacCutchan5-Feb-15 21:56
mveRichard MacCutchan5-Feb-15 21:56 
GeneralRe: Socket IAsyncResult - Catch SocketError Pin
sheldons6-Feb-15 5:59
sheldons6-Feb-15 5:59 
GeneralRe: Socket IAsyncResult - Catch SocketError Pin
Richard MacCutchan6-Feb-15 6:01
mveRichard MacCutchan6-Feb-15 6:01 
QuestionWord document converted to image is showing transparent background Pin
Member 103642244-Feb-15 22:27
professionalMember 103642244-Feb-15 22:27 
AnswerRe: Word document converted to image is showing transparent background Pin
BillWoodruff5-Feb-15 0:58
professionalBillWoodruff5-Feb-15 0:58 
AnswerRe: Word document converted to image is showing transparent background Pin
DelphiCoder5-Feb-15 17:50
DelphiCoder5-Feb-15 17:50 
QuestionDataGridView Pin
Member 113627094-Feb-15 21:25
Member 113627094-Feb-15 21:25 
QuestionDataGridView Pin
Member 113627094-Feb-15 21:14
Member 113627094-Feb-15 21:14 
AnswerRe: DataGridView Pin
Richard MacCutchan4-Feb-15 21:34
mveRichard MacCutchan4-Feb-15 21:34 
QuestionStack and heap Pin
Member 111616254-Feb-15 19:49
Member 111616254-Feb-15 19:49 
AnswerRe: Stack and heap Pin
Richard MacCutchan4-Feb-15 21:33
mveRichard MacCutchan4-Feb-15 21:33 
AnswerRe: Stack and heap PinPopular
OriginalGriff4-Feb-15 22:00
mveOriginalGriff4-Feb-15 22:00 
GeneralRe: Stack and heap Pin
Rob Philpott5-Feb-15 4:53
Rob Philpott5-Feb-15 4:53 

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.