473,657 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sanity check

I'm C# and would like to get a sanity check from the group to ensure
that I'm going down the right road.

The first form in my mini-application is a search screen. I have an
image of it here: www.netopia.ca/c_sharp/search.png . There is a
datagrid that uses a dataview as the data source. On a keyup event for
the textbox, I set the rowfilter property of the dataview. Here's the
code for the event:
private void txtSearch_KeyUp (object sender, KeyEventArgs e)
{
string strRowFilter;

if (txtSearch.Text .Length == 0)
{
// If no text is present, use no filter.
strRowFilter = "";
}
else
{
// Column 1 of the table is used for searching
strRowFilter =
_dvSearchResult s.Table.Columns[1].ColumnName + " LIKE '%" +
txtSearch.Text + "%'";
}

// Specify the row filter
_dvSearchResult s.RowFilter = strRowFilter;
}

That I think is fine. What I'm not sure that I did correctly is
related to the combobox. The combobox essentially dictates which table
the dataview is using to filter. I use the SelectedValueCh anged event
on the combobox to update a searchtype string:

private void cboSearchType_S electedValueCha nged(object sender,
EventArgs e)
{
// Set the search type
_strSeachType = cboSearchType.T ext;
}

The set accessor for the _strSeachType property is:
set
{
// Assign the Table of the DataView to the appropriate
table
if (value.Equals(" Domains"))
{
_dvSearchResult s.Table =
domainsDataSet. tbl_domains;
}
else if (value.Equals(" Customers"))
{
_dvSearchResult s.Table =
domainsDataSet. tbl_customers;
}
else if (value.Equals(" Registrars"))
{
_dvSearchResult s.Table =
domainsDataSet. tbl_registrars;
}
else
{
MessageBox.Show ("Invalid Entry for Search Type");
}

// Reset the row filter
_dvSearchResult s.RowFilter = "";

// Add a table style to the data grid. This allows us
to
// set the width of a column
DataGridTableSt yle dgts = new DataGridTableSt yle();
dgts.MappingNam e = _dvSearchResult s.Table.TableNa me;

// Clear the current table style and set the new one
dgSearchResults .TableStyles.Cl ear();
dgSearchResults .TableStyles.Ad d(dgts);

// Set the visible column
datagrid_SetVis ibleColumn(dgts , 1);

// Refresh the DataGrid
dgSearchResults .Refresh();
}

I'm wondering if I did this correctly or not. Ultimately it works but
I'm wondering what the better ways are.

I have questions about my dgSearchResults _MouseDown() method, but I
think I'll same that for another post.

The full code for this form is at http://www.netopia.ca/c_sharp/SearchForm.cs
..

thanks,

Aaron

Sep 20 '07 #1
0 1255

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1608
by: Lars Eighner | last post by:
I'm looking for a sanity checker for css comparable to tidy or weblint for html on a unoid system (FreeBSD). Any suggestions. -- Lars Eighner -finger for geek code- eighner@io.com http://www.io.com/~eighner/ If it wasn't for muscle spasms, I wouldn't get any exercise at all.
9
2703
by: Fred Ma | last post by:
Hello, I posted previously under the thread: How to break this up into streambuf/ostream I've asked our library to get "C++ IOStreams and Locales..." by A. Langer et al. Meantime, I've looked at the C++ standard (ISO/IEC 14882) from the web to get a grip on the relationship between ostream methods and streambuf methods: flush(), operator<<(), sputc(),
10
1492
by: Bob Hollness | last post by:
OK. The below text is from the MySQL website. "When you connect to a MySQL server, you should use a password. The password is not transmitted in clear text over the connection. Password handling during the client connection sequence was upgraded in MySQL 4.1.1 to be very secure" Has anyone actually tested this by "sniffing" their packets during use? Also, does anybody know if this applies when using VB to connect using the connection...
2
2889
by: Jonathan Pryor | last post by:
I'm in need of a sanity check: is the following code valid C++? namespace foo { class NamespaceClass { }; } using namespace foo; class Bug_GlobalFriendDeclaresNamespaceClass {
32
4083
by: ma740988 | last post by:
template <class T> inline bool isEqual( const T& a, const T& b, const T epsilon = std::numeric_limits<T>::epsilon() ) { const T diff = a - b; return ( diff <= epsilon ) && ( diff >= -epsilon ); } int main() { std::deque<double> pt ;
1
1285
by: Dave | last post by:
Hi all, Is there a place to request a vulnerability check on a website? I had a problem that I think I fixed, but I'm fairly inexperienced with PHP (which is why I had the problem in the first place) and I wanted to have it run though by some more experienced coders to see if there is anything else I missed. Thanks -Dave
6
3394
by: Dan Henry | last post by:
I need a sanity check. The following is an exchange on comp.arch.embedded with CBFalconer in a rather long MISRA related thread. Since my little section of that thread and area of interest was never really about MISRA, but rather the one's complement representation of integer constant 0 and now how to zero memory portably, I am bringing the topic to this group. Try to ignore CBF's errors in the 1's complement -1 and sign magnitude -1...
2
3043
by: eholz1 | last post by:
Hello CSS and StyleSheet members, I have decided to move away from Dreamweaver javascript rollover buttons, in favor of a CSS type rollover button. (hope that is ok). I plan to use PHP to include the page with the rollover buttons as a php include in a div for navigation buttons (left side of web page). I have cobbled together some code complements of http://sophie-g.net/jobs/css/e_buttons.htm.
3
1795
by: stevewilliams2004 | last post by:
I am attempting to create a singleton, and was wondering if someone could give me a sanity check on the design - does it accomplish my constraints, and/or am I over complicating things. My design constraints/environment are as follows: 1) Everything is single-threaded during static initialization (as in prior to the open brace of main) 2) The environment may be multi-threaded during nominal program execution (within {} of main) 3) I...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.