Click here to Skip to main content
15,914,409 members
Home / Discussions / C#
   

C#

 
GeneralRe: Array of bitmaps. Pin
AKXman15-Apr-08 12:52
AKXman15-Apr-08 12:52 
GeneralRe: Array of bitmaps. Pin
Luc Pattyn15-Apr-08 13:12
sitebuilderLuc Pattyn15-Apr-08 13:12 
GeneralSerialize this OBJECT! Pin
zaboboa14-Apr-08 10:06
zaboboa14-Apr-08 10:06 
GeneralRe: Serialize this OBJECT! Pin
Zoltan Balazs14-Apr-08 10:37
Zoltan Balazs14-Apr-08 10:37 
QuestionHow to show a new record, and not the first (Windows Forms) Pin
Alessandra7714-Apr-08 9:56
Alessandra7714-Apr-08 9:56 
GeneralRe: How to show a new record, and not the first (Windows Forms) Pin
Expert Coming14-Apr-08 13:04
Expert Coming14-Apr-08 13:04 
GeneralFindNext on BindingSource Pin
jchalfant14-Apr-08 8:56
jchalfant14-Apr-08 8:56 
AnswerRe: FindNext on BindingSource Pin
jchalfant14-Apr-08 10:45
jchalfant14-Apr-08 10:45 
I guess I was on the right track. Here's the code that makes it work.

BindingSource _mainBS;<br />
string _fieldname;<br />
TARData.TARDataSet.DataRow[] _mRA;<br />
string _searchstring;<br />
int _currentPosition;


_mainBS is assigned by a constructor, likewise _fieldname.

public void FindNext() {<br />
            if (_searchstring != textBox1.Text)<br />
            {<br />
                _searchstring = textBox1.Text;<br />
                _currentPosition = 0;<br />
                string searchCrit = getColumnSearchString(((DataRowView)_mainBS.Current).DataView.Table.Columns[_fieldname].DataType);<br />
                _mRA = (TARData.TARDataSet.Carter_TAR_MainRow[])((DataRowView)_mainBS.Current).DataView.Table.Select(<br />
                    searchCrit + " LIKE '%" + _searchstring + "%'");<br />
            }<br />
<br />
            if (_mRA.Length > 0) {<br />
                this._mainBS.Position = this._mainBS.Find("Main_ID", _mRA[_currentPosition]["Main_ID"]); ;<br />
            }<br />
            _currentPosition = (_currentPosition + 1) % _mRA.Length;<br />
        }


Just in case _fieldname is an int type, I throw in this little tidbit to perform a convert.

private string getColumnSearchString(Type type)<br />
{<br />
    if (type == typeof(int))<br />
        return "Convert(" + _fieldname + ",System.String)";<br />
    else return _fieldname;<br />
}


Not too efficient, but I still like admiring it. Not a bad way to spend an hour of my day.
QuestionUnboxing Question Pin
jka34714-Apr-08 8:39
jka34714-Apr-08 8:39 
GeneralRe: Unboxing Question Pin
Pete O'Hanlon14-Apr-08 9:10
mvePete O'Hanlon14-Apr-08 9:10 
GeneralRe: Unboxing Question Pin
jka34714-Apr-08 9:23
jka34714-Apr-08 9:23 
GeneralRe: Unboxing Question Pin
PIEBALDconsult14-Apr-08 17:29
mvePIEBALDconsult14-Apr-08 17:29 
GeneralSystem.NullException Error Pin
tcombs0714-Apr-08 8:26
tcombs0714-Apr-08 8:26 
GeneralRe: System.NullException Error Pin
Luc Pattyn14-Apr-08 9:01
sitebuilderLuc Pattyn14-Apr-08 9:01 
GeneralRe: System.NullException Error Pin
tcombs0714-Apr-08 9:29
tcombs0714-Apr-08 9:29 
GeneralRe: System.NullException Error Pin
Luc Pattyn14-Apr-08 9:56
sitebuilderLuc Pattyn14-Apr-08 9:56 
GeneralSQL statement Pin
vanessa12314-Apr-08 8:08
vanessa12314-Apr-08 8:08 
GeneralRe: SQL statement Pin
Rob Philpott14-Apr-08 8:18
Rob Philpott14-Apr-08 8:18 
GeneralRe: SQL statement Pin
Rob Philpott14-Apr-08 8:19
Rob Philpott14-Apr-08 8:19 
GeneralSerializing object. Need Help. Pin
zaboboa14-Apr-08 6:33
zaboboa14-Apr-08 6:33 
GeneralRe: Serializing object. Need Help. Pin
Zoltan Balazs14-Apr-08 7:23
Zoltan Balazs14-Apr-08 7:23 
GeneralC#: WriteEncrypedFileRaw Pin
rreeeddbb14-Apr-08 6:28
rreeeddbb14-Apr-08 6:28 
GeneralWindows Service Installer Pin
Madmaximus14-Apr-08 6:28
Madmaximus14-Apr-08 6:28 
General"The given path's format is not supported." Pin
shivapriyak14-Apr-08 4:36
shivapriyak14-Apr-08 4:36 
GeneralRe: "The given path's format is not supported." Pin
Mark J. Miller14-Apr-08 4:48
Mark J. Miller14-Apr-08 4:48 

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.