|
The part that I don't understand is the top level tags; I add them at the beginning of my while-loop and close them at the end, so the XML document is 'correct'. But then there seems to be some issue with opening up the second saved file - yet it uses the same part of code that adds the tags at the beginning, so should open. When I increase the for-loop to include all records it errors saying my tag isn't closed - yet it is, and closes fine for the smaller loop...
|
|
|
|
|
Progress? Not sure...
If I comment out the part that adds 'messageHeader', the first file completes and this time I can open the seciond file. This has some records in, before near the end it has the error saying 'message' was not closed, even though it is in my code. I don't know if this helps, but I feel I'm getting closer!
|
|
|
|
|
Hi
i made a search module that search a file in any selected drive.
How can i use a progress bar
what will be tha min ,max time and increament steps
|
|
|
|
|
How long is a piece of string ?
You really have no way of knowing. That's why windows tends to show a progress bar that just moves back and forth in those sort of scenarios, or even if it's copying files, it shows a time but often gets it wrong.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
It will be decided dynamically on the basis of total number of files searched in the worst case, i.e. total number of files present in the directory.
for eg, say you have 10000 files then min will be 0 max will be 100 step will be 1, after every 100 files are searched the step will be incremented and when you find the specific file the value will become 100, and about time... well, Chris is right, you never know exactly.
Waqas Nasir,
Software Engineer,
EzValidation Inc,
Karachi,
Pakistan.
|
|
|
|
|
Hello everybody.
Someone know how show on toolStripProgressBar the progress at retrive data from SQL Query?
Example:
SQL Structure:
CREATE TABLE [student](<br />
[student_id] INT NOT NULL IDENTITY(1,1),<br />
[student_name] VARCHAR(50) NOT NULL,<br />
[student_lastname] VARCHAR(70) NOT NULL,<br />
[student_age] TINYINT NOT NULL,<br />
[student_since] SMALLDATETIME NOT NULL DEFAULT GETDATE(),<br />
[student_grade] TINYINT NOT NULL,<br />
[student_active] BIT NOT NULL DEFAULT 1,<br />
PRIMARY KEY( [student_data_id] )<br />
)
CREATE TABLE [class](<br />
[class_id] SMALLINT NOT NULL IDENTITY(1,1),<br />
[class_name] VARCHAR(50) NOT NULL,<br />
[class_acive] BIT NOT NULL DEFAULT 1,<br />
PRIMARY KEY( [class_id] )<br />
)
CREATE TABLE [class_by_student](<br />
[class_id] REFERENCES [class] ( [class_id] ),<br />
[student_id] REFERENCES [student]( [student_id] ),<br />
PRIMARY KEY( [class_id], [student_id] )<br />
)<br />
C# Code:
<br />
using System;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
using System.Windows.Forms;<br />
using System.Thread;<br />
<br />
public class Form1 : Form<br />
{<br />
private System.ComponentModel.IContainer components = null;<br />
private StatusStrip sb;<br />
private ToolStripProgressBar pb;<br />
DataGridView dg;<br />
Thread Thread4LoadData;<br />
<br />
public Form1()<br />
{<br />
this.makeForm();<br />
}<br />
<br />
public makeForm()<br />
{<br />
this.sb = new StatusStrip();<br />
this.pb = new ToolStripProgressBar();<br />
this.dg = new DataGridView();<br />
((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit();<br />
this.sb.SuspendLayout();<br />
this.SuspendLayout();<br />
<br />
this.sb.Items.Add(this.pb);<br />
this.sb.Name = "sb";<br />
<br />
this.pb.Name = "pb";<br />
this.pb.Size = new System.Drawing.Size(100, 16);<br />
<br />
this.dg.Location = new System.Drawing.Point(12, 42);<br />
this.dg.Name = "dg";<br />
this.dg.Size = new System.Drawing.Size(464, 374);<br />
<br />
this.Controls.Add(this.sb);<br />
this.dg.Add(this.dg);<br />
((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();<br />
this.Name = "Form1";<br />
this.Text = "Staudents";<br />
this.Load += new System.EventHandler(this.Form1_Load);<br />
this.sb.ResumeLayout();<br />
this.sb.PerformLayout();<br />
this.ResumeLayout(false);<br />
this.PerformLayout();<br />
}<br />
<br />
private void Form1_Load()<br />
{<br />
Thread4LoadData = new Thread( new ThreadStart( this.LoadData ) );<br />
Thread4LoadData.Start();<br />
}<br />
<br />
private void LoadData()<br />
{<br />
string connStr = "server=myserver.com.;database=school;uid=sa;password=666;Trusted_Connection=False;";<br />
SqlConnection conn = new SqlConnection(connStr);<br />
conn.open();<br />
<br />
string SQL;<br />
SQL="SELECT * " + <br />
"FROM [class_by_student] AS [cs]" +<br />
"JOIN [class] AS [c] ON [c].[class_id] = [cs].[class_id]" +<br />
"JOIN [student] AS [s] ON [s].[student_id] = [cs].[student_id]" +<br />
"WHERE [s].[student_active] = 1 " +<br />
"AND [c].[class_active] = 1" +<br />
"ORDER BY [S].[student_name]";<br />
<br />
DataSet dts = new DataSet();<br />
<br />
SqlDataAdapter da = new SqlDataAdapter( SQL, conn );<br />
da.Fill(dts, "schools");<br />
this.dg.DataSource = dts;<br />
this.dg.DataMember = "schools";<br />
conn.close();<br />
}<br />
}<br />
I need show the progress when data is downloading because sometimes the time is longer.
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
You can't. Your query starts, and it ends, there's no step in between where you get feedback from the db or, ( in a single threaded app ) where your code does anything at all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
lo;
i am reading a string from my comm port,
i want to check it wether it is a letter or a number,
if it is a letter i need to give an error, if it is a number i want to check if it is smaller then 500
how do i do this?
grz & thx
|
|
|
|
|
If it's a char, you can use Char.IsDigit and Char.IsLetter. If it's a full string, then try this:
int n;
if (int.TryParse(str, out n) && n < 500)
{
}
else
{
// Not a number, or >= 500
}
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You can use a regular expression with the pattern "^\d{1,3}$" to check if the string contains only digits and not more than three digits. If it does, you can safely use int.Parse to parse it to an integer, and check the value.
---
b { font-weight: normal; }
|
|
|
|
|
thx, but i have found something else
public bool hasNumber(String s)
{
for (int j = 0; j < s.Length; j++)
{
if (!Char.IsDigit(s,j))
{
return false;
}
}
return true;
}
and to know wether it is a letter, just the oppesit :p
thx though
|
|
|
|
|
Yes, that works too. Or even simpler:
public bool hasNumber(String s) {
foreach (char c in s) if (!Char.IsDigit(c)) return false;
return true;
}
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I want to disable "Form Close" option of a child form if any background worker is busy in that form. How can I implement that in C# ?
Because, IF an user closes a child form when a background worker is busy in that form, then, very bad problem occurs when the background worker completed event triggered.
Regards.
|
|
|
|
|
Hi
Iam developing WindowsMobile Application VS2005, I want to bind Listview(with three columns) in a seperate thread bcoz it always needs to refresh from database by timer.
How can I use Control.Invoke with ListView?Is it possible.
I have tried ListBox Binding, but only one column possible.
Please help
|
|
|
|
|
Hi
i use a listbox control that contains number of files.i want to select multifiles and when i select a file a check should appear in front of file
How can i do this
Parshant
|
|
|
|
|
Hi
I think you are in wrong way.
There is no request to add checkbox to listbox control.
You can use CheckedListBox control, you can find it under listbox control in your toolbox.
Bye
|
|
|
|
|
But how can i do it in web application. there is no control like checkedlistbox ??
|
|
|
|
|
Hi Dear All Respected Programmers
Kindly let me know that, Is there any method of ConnectionString to connect with Oralce10g or (if any above 8x) database without installling Oracle client software or Oracle net?
Thank you in Advance
|
|
|
|
|
There is no way. You'll definitely need the client.
|
|
|
|
|
Well, if one can help - it would be nice!
I have a simple property that returns an object of class MyClass.
Within this property i defines the "get" as well as the "set" accessors.
Somthing like...
public MyClass MyPropertyName
{
get{return _myPropertyName;}
set{_myPropertyName = value;}
}
The "get" accessor, as we all know, returns a reference to the _myPropertyName, so outer code can easily change the _myPropertyName public fields.
The "set" accessor however change the whole object, that is, replace the current _myPropertyName with the specified "value" object.
The question:
Is it possible to lock the fields of _myPropertyName from changing when accessing them using the "get" accessor?
Ok, I know that i can define the "MyClass" fields as readonly fields and initialize them within the instance constructors, however, these field must be writeable in my application.
I also know that i can use internal field in "MyClass" that inidicates whether the instance is readonly and check this value whenever a property is gonna be changed by outer code.
What i looking for is a solution that eliminates the need of much code to handle this requirement.
Ok, if anyone faced the same requirement and solve this problem in ease way, and could post his solution - it would be nice.
Thanks in advanced, elaj.
|
|
|
|
|
The easy way to solve this:
public MyClass MyPropertyName
{
get{return _myPropertyName.Clone();}
set{_myPropertyName = value;}
}
They get a copy, so any changes are not reflected in your object.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Interesting and, in retrospect, obvious answer. I didn't think of that.
Thanks!
|
|
|
|
|
There is no way of making an object dynamically read-only wihtout logic in the class.
An alternative could be to make a wrapper class that only exposes the contents from the class as read-only. Example:
public class MyClassReader {
private MyClass _daClass;
public MyClassReader(MyClass daClass) {
_daClass = daClass;
}
public int SomeProperty { get { return _daClass.SomeProperty; } }
public string SomeOtherProperty { get { return _daClass.SomeOtherProperty; } }
}
Another alternative could be to make the properties virtual and make a class that inherits from MyClass and overrides the properties and throws an exception if the set accessor is used.
A bit of code in both cases, but both these alternatives has the advantage that it leaves the original MyClass unchanged (or mostly unchanged) and unaware of all the fuss.
---
b { font-weight: normal; }
|
|
|
|
|
I have MDI application.
when I open an application form with "show" function and suppose some process is going in that application form and close form.but
My Mdi application focus change with other windows task. how can I solve this problem?
|
|
|
|
|
I writ a code IN C# that print table + data to the printer.
I have laser printer with 64M memory.
but when I send to the printer about 500 pages I have a Problem.
about 50 pages the spooler of winXP start goes slowly.
what can I do ?
I have The Same code In VB and hi works More Good - but In WIN98.
Can I pass The spooler?
Can I writ The data to file and then send it to print?
can I save the table in "System.Drawing.Printing.PrintPageEventArgs"
and add to this event any time data????
Can I writ In PS???
|
|
|
|