|
If I populate a combo box manually with items, I can get the selected item using
comboBox.SelectedItem.ToString();
But now I have created a databound combobox, but cannot find out how to get its selected value.
comboBox.SelectedItem.ToString();
Returns System.Data.DataRow
and
comboBox.SelectedText.ToString()
returns "". Even though a value is selected.
How can I get the selected text/value of a datbound comboBox??
|
|
|
|
|
Well. Whats the problem here??
comboBox.SelectedItem contains the DataRow ... just use it.
Alex Korchemniy
|
|
|
|
|
Does anyone know where I can find information on how LIMS are designed? Specifically I'm wondering how a user of a LIMS system can define Materials to test and test methods / results and the program store data correctly for each result type. The front end will be written in C#.
Here's an example of what I need to do:
I have a material id as Liquid 7 which we test regularly. The tests include maybe a moisture (float data type) and a solids (float).
Now we are getting a new material Liquid 9 with tests moisture, solids and Pass. Moisture and solids are the same as for Liquid 7, but Pass is a string based off a visual check of the liquid.
I don't want to manually create a new database table for each new raw material we receive and test. I want an end user to define the test name and test result type and my program somehow store this data in a database for retrieval and analysis.
I don't know how commercial LIMS implement this but if anyone has any ideas I could use them.
|
|
|
|
|
Create a table for each possible test, and a joining table to define what tests occur for each liquid.
Like this
Liquids - int ID (identity), nvarchar(20) name
TestA - int ID (identity), int LiquidID, int result
TestB - int ID (identity), int LiquidID, nvarchar(20) result
LiquidTests int LiquidID, int TestID
Now you can create each liquid, defining which tests it has to take part in, by putting rows into LiquidTests. The LiquidID column in the tests is not needed for this, but if you make it unique, you can then enforce that no test goes in twice for the one liquid.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for replying, that may be the way I end up going but I need to think about it more.
I thought about doing it that way before but was worried about the extra space taken up by the identity and LiquidID fields for each result.
A new table would also need to be made for each new test result, though this would occur alot less often than we add new Liquids. It would also result in fewer tables than having each liquid in a seperate table.
Our current solution ( I inherited it ) is in access with the tables for each liquid like this:
Liquid A - Record No, Lot No, Date, Analyst, Moisture, Solids, ...
Liquid B - Record No, Lot No, Date, Analyst, Moisture, Solids, Viscosity, ...
Liquid C - Record No, Lot No, Date, Analyst, Moisture, NCO, Visual Check, ...
... for about 50 more
When we get a new liquid we add a new table with fields for the tests we need to run. Most Liquids have more result fields than this (usually from 10 to 15 results.
Most of the time we get the same Liquids in and just add to the current tables but occasionally we get new Liquids.
|
|
|
|
|
drdavis wrote:
I thought about doing it that way before but was worried about the extra space taken up by the identity and LiquidID fields for each result.
I think you're losing more space in the overhead of creating a table for each liquid. Either way, we're not talking about a whole lot of space, unless this really old hardware with a 400 MB drive or something ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
We have plenty of hard drive space. I'll build a prototype doing it this way and populate it with the current data we have to check the performance.
|
|
|
|
|
I doubt if any 2 LIMS are even close to the same in design. I have been involved in the design and implementation of several related LIMS, and in projects where data is shared between unrelated LIMS; It's a free-for-all out there.
Most LIMS do have a table of test codes. Some LIMS will allow you to apply a test code to any matrix, but some of them have you enter a new test code if you want to have the same test in a different matrix (material).
For a simple LIMS I might set up these tables for testing materials:
Materials
MaterialID int
MaterialName nvarchar(20)
MaterialDescription nvarchar(255)
TestCodes
TestID int
TestName nvarchar(20) -- something small enough to easily display in a combobox
TestDescription nvarchar(255)
Results
ResultID int
SampleID int -- Links to the sample you tested
NumberResult float
TextResult nvarchar(50)
...other fields relating to the test (person who ran test, date, etc.)
Samples
SampleID int
SampleCode nvarchar(50) -- depends on the code you or your client give to samples
MaterialID int -- foreign key to the Materials table
...other fields describing the sample or its origin
Tests -- put entries in here when you decide to run a particular test on a particular sample
SampleID int -- foreign key to the Samples table
TestID int -- foreign key to the TestCode table
This structure is highly simplified, but would be a good starting point to a simple LIMS. A more complicated LIMS would need a lot more supporting fields and tables, including some quality assurance stuff. Also, scientific results are usually reported with correct significant figures, which means the final results can only be stored as properly formatted strings.
|
|
|
|
|
In the results table why is there "NumberResult float" and "TextResult nvarchar(50)"? Would only one have a value for any one test, depending on the test result type?
This is just for inhouse testing, with me doing the programming on the side. My actual job is doing the testing on the samples.
|
|
|
|
|
I did that to really simplify the design. A nvarchar(in ms sql server) will not take up much space if unused, that way you can keep all results in the same table. Most LIMS work I have done has been in the environmental and bioanalytical fields. I have never had results that were text, therefore, I would expect the TextResult field to usually be blank.
It could be done with 2 tables, but the added complexity for the extra indirection could be avoided. If most of the results will be float, then there is very little waste of space. It's just a design decision for which I have too little information to make a call.
A commercial LIMS would have a table structure closer to the example I gave than what yours is like. The reason is flexibility (a commercial product has to meet more general needs). It makes adding new things easier(new tests, new materials, etc.), but requires more complex queries to get back the result data(joining data from Samples, Materials, Results, TestCodes just to get a report). As long as the database is designed well, a 7 table join can pull data from a multi million row database in a second or two, but if not well designed, could take 20 or more seconds.
In the end, if its working now, just go with it! If you have the time and want to play with a new design, go ahead, but please make sure you don't try anything on the live database; make a new database for your redesign efforts.
|
|
|
|
|
I try to update or insert a record in MS SQL Server 2000 sp3 from C# using the following SQL "update products set ProductName='" + txt.Text + "' where productid=1". In the txt.text I type a phrase in various languages like english, spanish, french and greek. What I get in the database is just garbage. However if I type this directly in the SQL Enteprise Manager works perfectly well. This does not work in SQL Query Analyzer either. Does anybody have an idea what am I missing?
Nick
|
|
|
|
|
If you're passing in UNICODE characters, make sure that your column type is NCHAR, NVARCHAR or NTEXT.
Also, investigate SQL Injection Attacks[^] and the usage of parameterized queries to make your application more secure.
|
|
|
|
|
I'm using some code that returns a string[] with a list of all the servers. I want to iterate thru them on at a time and check the names against one that I already have to see if it's being found.
How do I move thru each server name in a string[]?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
There are two ways to do it:
First is to use the IEnumerable interface of the Array:
function bool AlreadyFound(string serverThatWasFound)
{
string[] serverList = GetTheServerList();
foreach(string server in serverList)
{
if (server == serverThatWasFound)
return true;
}
return false;
}
Second is a simple loop:
function bool AlreadyFound(string serverThatWasFound)
{
string[] serverList = GetTheServerList();
for(int i=0;i<serverList.Length;i++)
{
if (servers[i]== serverThatWasFound)
return true;
}
return false;
}
/cadi
24 hours is not enough
|
|
|
|
|
Thanks the second one did it.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi,
is it possible on a monthCalendar to specify multiple dates that do not fall into 1 range?
For example, every Monday in a month or Mon to Friday every week within a month?
So far I have only been able to highlight 1 range or a single date?
Any help would be greatly appreciated.
Thanks
Scotty
|
|
|
|
|
Not possible. In fact, even the normal range is broken with XP themes.
You can always write your own control.
Alex Korchemniy
|
|
|
|
|
Alex Korchemniy wrote:
Not possible.
Thats what I was afraid of. Oh well alternate solution it is then.
Thanks for replying anyway
S
|
|
|
|
|
i am creating a databound treeview but i am having trouble with my properties.
I created a collection to hold the labels. and i added to the designer.
I can create the labes, however, i do not know how can i save it;
public class MyTreeColumns // this is my class containing the string label
public class MyTreeColumnsCollection:CollectionBase // this is my collection of labels with methods for indexing, Add, Indexof, insert, remove, and contains.
in the dataTreeView class I added:
MyTreeColumnsCollection _objects = new MyTreeColumnsCollection();
[Browsable(true)]
public MyTreeColumnsCollection TreeColumns
{
get
{
return _objects;
}
set
{
_objects = value;
}
}
what i am missing?
thank you
drey
|
|
|
|
|
I think you have to mark your classes as [Serializable] .
Depending on your object structure you might have to implement the ISerializable and IDeserializationCallback interfaces. (Like Hashtable does)
/cadi
24 hours is not enough
|
|
|
|
|
that's what i was missing!
and the :
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
thank you
drey
|
|
|
|
|
Dear programer.
I wan't to use MS Word as my Email Editor Like MS OutLook
any one can help me for this subject
or help me for finding other way's
tank's a lot
rashidi
|
|
|
|
|
What exactly are you trying to code ??
Alex Korchemniy
|
|
|
|
|
Dear Alex.
I am writing a c# program.
I need to have file editor like MS word integreted with my software.
I need Editor Like RichText Editor But With MS Word capability.
Can I use MS Word API For this Perposes.
tanks.
rashidi.
|
|
|
|
|
Its possible to use the webbrowser control as an OLE container and then host Word inside of that but I recommend against it.
There are commercial components available that are fairly powerful. Some components even mimic VS.net IDE for example Syncfusion edit component. Search around on google.
Alex Korchemniy
|
|
|
|