|
1. uslesss subject line
2. databinding
3. UjwalGwoda wrote: i am fresher so?
4. UjwalGwoda wrote: its urgent of course it is, silly us for not responding sooner.
Note - there is clue in the above.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi guys...
How to create radio buttons dynamically and assign textbox value to radio button text.
Krish
|
|
|
|
|
RadioButton is an ordinary class so to create new instance you just need to call its constructor and assign it some variable. Like this: RadioButton rd = new RadioButton() It has a property called Text so you can use it to set its text. The text can come from any source. rd.Text = myTextBox.Text
Note the radiobutton will not be visible if you don't add it to a form or container control.
|
|
|
|
|
Thanx dude its working.
Very good support
|
|
|
|
|
You are welcome
|
|
|
|
|
I am programming a movie info collect tool. I think store all data with XML is OK.
Here is the MovieDataXML
<?xml version="1.0" encoding="utf-8" ?>
<Data>
<Movie>
<ChineseName>aa</ChineseName>
<EnglishName>aa</EnglishName>
<Year>aa</Year>
<Area>aa</Area>
<Type>aa</Type>
<Language>aa</Language>
<Subtitle>aa</Subtitle>
<IMDB>aa</IMDB>
<Resolution>aa</Resolution>
<Director>aa</Director>
<Actors>aa</Actors>
<Introduction>aa</Introduction>
<BelongTo>aa</BelongTo>
<DiscNumber>aa</DiscNumber>
</Movie>
</Data>
And when I try to read the data.
ClassXMLHandler clsXmlHandler = new ClassXMLHandler();
string strMovieData = "Data";
XmlNode xNodeMovieData = clsXmlHandler.MovieDataDocument.SelectSingleNode(strMovieData);
XmlNodeReader xReader = new XmlNodeReader(xNodeMovieData);
Here is the problem
If I read XML data by DataTable
There will be a Exception "DataTable does not support schema inference from Xml",
If I create this DataTable schema manually,there is no data in that DataTable.
DataTable dtMovieData = new DataTable();
dtMovieData.ReadXml(xReader);
But I found it is OK if I use DataSet instead of DataTable
DataSet ds = new DataSet();
ds.ReadXml(xReader);
I don't know why.
|
|
|
|
|
I get this string from device : 6.623E-2\n,#wz4y
How do i get 6.623E-2 ?
thanks
|
|
|
|
|
|
|
What about
- yourstring.Split(new char[] { '\n' }) or
- yourstring.Substring(0, yourstring.IndexOf('\n') or
- Regex.Match with pattern @"^([^\n]+)\n.*"
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
\n or \r\n are concidered new lines.
if you load following string:
"test\r\nmore test"
in a multiline textbox it will appear:
test
more test
|
|
|
|
|
|
But you need to be sure that the '\n' is there or test for -1.
|
|
|
|
|
Hi,
How can i "store" a image in a xml file?
I am thinking in a byte[] like in sql server.
<user>
<f_name>John<f_name>
<l_name>Black<l_name>
<image>w3cvbjr7lerr4hh56ws2<image>
<user>
Any help welcome; link, code, whatever
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Since you can't stored just any old character you want in an XML file, you'll have to convert the image to a string that XML can hold. A thought off the top of my head says convert it to a base64 string and store that.
|
|
|
|
|
|
I have a application I have built that uses a SQL Server express database to store the data. I have built a logging functions which writes the log entrys of whats going on in the application to a text file on the hard disk. When I set the logging to DEBUG mode (which logs a ton of stuff) it takes a long time for certain things to run as its writing a bunch of data to the text file. If they set the logs to WARN... it only writes important information to the log file.
This all works great, but I would really like to log everything so if there is a problem with the application I can look at the users log file and tell exactly what they were doing to try and reproduce the error. So I was thinking about writing the logs to the database which would mean I could insert all entrys and just query the items I need to return which brings up my question.
If i start to insert a ton of data into the database, at what point could I overload the database?
XXX Querys a hour/second?
Database reaches XXX size?
I know this will depend on the users machine also, but its not going out to a wide user base, more like 10 people.
|
|
|
|
|
Brad Wick wrote: I know this will depend on the users machine
This is just 1 of the considerations. Database design will have a big impact, as will proper connection control and a whole host of other things. I suspect the only real way of finding out is to test it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am passing in the procedure name and a parameter array. The values in the array are correct, yet I'm not getting any data back:
public DataSet ExecuteQueryProc(string sParameterName, SqlParameter[] ParamArray)
{
DataSet oDataSet = new DataSet();
SqlConnection oConn = GetConnection(true);
if (oConn != null)
{
SqlCommand oCommand = new SqlCommand();
oCommand.Connection = oConn;
oCommand.CommandText = sParameterName;
oCommand.CommandType = CommandType.StoredProcedure;
oCommand.Parameters.AddRange(ParamArray);
SqlDataAdapter oAdapter = new SqlDataAdapter();
oAdapter.SelectCommand = oCommand;
oAdapter.Fill(oDataSet);
}
return oDataSet;
}
>
Anyone wanna take a stab it this?
Everything makes sense in someone's mind
|
|
|
|
|
oConn equaling null would result in no data.
Just because we can; does not mean we should.
|
|
|
|
|
Have you tried running the proc in query analyser with the EXACT paramters you are passing? Its often easy to get a trailng space on a string that results in no data, or similar problems. I often just do a bit of code to generate the exact call (with the param values in the correct quites etc), then test it in query analyser.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi
I have a project where I want to start X threads for processing in the background while the main thread does other stuff. However, as soon as the main thread is finished with its work it should wait for all the other threads to finish before continue.
I looked at threadpool and found it to be insufficient (due to reasons I will not discuss here).
What I try instead is to implement my own pool of threads starting with:
Thread[] threads = new Thread[numthreads];
for (int i = 0; i < this.threads.Length; i++)
{
threads[i] = new Thread(Handler);
threads[i].Start();
}
I figured I could use ManualResetEvent to wait for the threads to finish. My question is this though:
Can I use a single resetevent for all threads to signal, or do I really need to have <numthreads> resetevents and use WaitHandle.WaitAll()?
How about the other way around? Can I have a single resetevent that all threads are listening to (waiting for input to process), and then only the first thread to catch the signal from the mainthread to actually start processing?
|
|
|
|
|
If your worker threads are terminating after they have done their work, you can just use Thread.Join on each one from your main thread.
If they stay around in a loop, waiting for the next batch of work, then you need a Barrier ( not a memory barrier - that's something different ). As it happens, I've just been playing with the new Barrier class in .NET 4.0, but I guess that doesn't help you much
The easiest way to implement this at the moment, is to have an int that you set to your numthreads before you start the threads. When each thread finishes its work, it calls Interlocked.Decrement and if it is the last thread, it signals an AutoResetEvent that the main thread is waiting on.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
I'm having an odd issue that appears to have cropped up out of nowhere.
I have a program that uses a plugin interface to add separate modules. I have the main application project, and main function library, and about 6 plugins. In the library, I've defined a Global class to access a few static variables. I needed a dispatcher reference, so I added a static variable in the Global class, which is then set when the main application starts up. The plugins will often then use this variable when they need a dispatcher and none is available.
Originally, this all worked fine, and I haven't changed anything in the Global class; however, now, none of the plugins can see the value of the static variable. I did a little testing, and was able to find this:
If I declare a variable, but don't set a value in the Global class; but then give it a value in the Main Application, it comes up as null when read by a plugin. I have:
In the Global class:
public static string Test;
In Window_Loaded for main app:
Global.Test = "Test";
When checking in a plugin:
MessageBox.Show(Global.Test);
it returns null. I do have a reference to the Global class in the plugin.
If I set the value in the declaration in the Global class it works fine:
In the Global Class:
public stating string Test = "Test";
If I then add this to the Window_Loaded of the main app:
Globa.Test = "MyNewTest";
In the plugin, it displays "Test", even though it was previously set to "MyNewTest" at startup.
I have also checked the value from the main app - checking the value at anytime in the main app returns the correct "MyNewTest".
It appears that when the variable is assigned a value from the main application project, it is not accessible from any of the plugin projects (all different classes, of course).
As I mentioned, this previously worked fine, and I haven't altered the Global class. Additionally, I've also checked plugins that I haven't changed, and they don't seem to work now either, even though none of the components have changed (I've added new plugins, but checking the main app, the Global class and a plugin, all of which have not changed, still show this issue).
Any insight on this would be greatly appreciated.
Thanks,
Mike
|
|
|
|
|
Do you use multiple threads? If yes, you may try to use the volatile keyword for the variable:
public static volatile string Test;
regards
modified 12-Sep-18 21:01pm.
|
|
|
|