|
You will get the solution from the demo after you have submitted your assignment to Wepenaar on friday 12:05 am.I already have the solution but i will give you at 12:06 friday,after the due date to submit.
|
|
|
|
|
Hi all,
I have the following string “Shirt85” and I want to separate it in two different strings “Shirt” and “85” (85 can be a int) .. How can I do it?
e.g.
string1=Shirt
string2=85
I want that 85 no. from string.
|
|
|
|
|
Check your string characters one by one.
int resultstring; // For Numaric Value only
string resultstring1; // For String Value Only
for i =0 to len(string)
{
if isnumber(string.substring(i,1))== true
{
resultstring =convert.toint( string.substring(i,1));
}
else
{
resultstring1 = string.substring(i,1);
}
}
If you can think then I Can.
|
|
|
|
|
Thanx for reply but My code is in c#....
i modified code according to C#...but it gives error : The name 'len' does not exist in the current context......and for all string operations....What i have to do?m new wid this....is there any name space required to add into project.
|
|
|
|
|
String.Length or Microsoft.Visualbasic.len is gives the length of string.
You should have basic knowledge of Programming. Read books or search in Google for Basic Concept.
If you can think then I Can.
|
|
|
|
|
Or better:
{
string s = "String85";
string s1 = "";
string s2 = "";
int posn = s.IndexOfAny("0123456789".ToCharArray());
if (posn >= 0)
{
s1 = s.Substring(0,posn);
s2 = s.Substring(posn);
}
MessageBox.Show(string.Format("\"{0}\" \"{1}\"", s1, s2));
}
You could do the digit finding with a Regex, but this example is just to be obvious!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks for reply....
It works.....
thanks again!!
|
|
|
|
|
Hi, I want to do my progress bar in to pop up progress bar. i mean when i load something i want to pop up progress bar while progressing only. how can i do that. i wrote the coding for static progress bar. i mean drag & drop progrss bar from tool in to my form.
ProgressBar ProBar = new ProgressBar();
private void import(object sender, EventArgs e)
{
if (listView1.Items.Count == 0)
{
ImageList imageList = new ImageList();
imageList.ImageSize = new Size(100, 80);
imageList.ColorDepth = ColorDepth.Depth32Bit;
this.ProBar = new System.Windows.Forms.ProgressBar();
this.ProBar.TabIndex = 0;
this.ProBar.Maximum = dlg.FileNames.Length;
this.ProBar.Minimum = 1;
this.ProBar.Step = 1;
foreach (string path in dlg.FileNames)
{
FileInfo fileInfo = new FileInfo(path);
listView1.Items.Add(fileInfo.Name);
imageList.Images.Add(Bitmap.FromFile(path));
ProBar.PerformStep();
}
A S E L A
|
|
|
|
|
I guess I have already answered this few days back. To reiterate, you need to create a new form and place progress bar in that. Create methods in that form which updates the progress bar. You can call this method from your form whenever a progress happens.
|
|
|
|
|
Hi, thanks a lot for your reply,
may i know some thing...
how about if i creat a method in my exicting form and cal that method when i need progress bar.is this posible to do?? i tried this out but by this way i couldn't get progress bar like message box....
A S E L A
|
|
|
|
|
S K Y wrote: i couldn't get progress bar like message box..
What do you mean by progress bar like message box? A modal progress bar which will not allow to click on other forms when progress is shown? If yes, here is a method
1 - Create a new form say Progress
2 - Add a progress bar say "pb " to this form.
3 - Create a delegate in this form which will call back the method to execute from the progress window. Refer the following code
public class ProgressEventArgs
{
ProgressBar pb;
Form form;
public ProgressEventArgs(ProgressBar pb, Form form)
{
this.pb = pb;
this.form = form;
}
public void PerformProgress(int value)
{
form.BeginInvoke((MethodInvoker)delegate
{
this.pb.Value = value;
});
}
public void StopProgress()
{
form.BeginInvoke((MethodInvoker)delegate
{
form.Close();
});
}
}
public delegate void WorkStartedHandler(ProgressEventArgs pe);
public partial class Progress : Form
{
WorkStartedHandler method;
public Progress()
{
InitializeComponent();
}
public void ShowProgress(int minimum, int maximum, WorkStartedHandler method)
{
pb.Minimum = minimum;
pb.Maximum = maximum;
this.method = method;
new Thread(DoWork).Start();
this.ShowDialog();
}
void DoWork()
{
method(new ProgressEventArgs(this.pb, this));
}
} The above code is simple and self explaining. You can use this like
private void import(object sender, EventArgs e)
{
if (listView1.Items.Count == 0)
{
Progress p = new Progress();
p.ShowProgress(1, dlg.FileNames.Length, DoWork);
}
}
void DoWork(ProgressEventArgs pe)
{
int i = 0;
foreach (string path in dlg.FileNames)
{
.............
.............
++i;
pe.PerformProgress(i);
}
pe.StopProgress();
} I wrote the above code in CP editor directly, so expect some compile time errors.
|
|
|
|
|
Hi , have a good day ...
I don't know if this is the right place for my Question ...
so please excuse me if I am worng ....
My Question is :
if I excute On SQL Query Analyzer this Syntax (
dbcc checkdb ('master') )
then the SQL Query Analyzer will print a message like this :
DBCC results for 'master'.<br />
DBCC results for 'sysobjects'.<br />
There are 1221 rows in 23 pages for object 'sysobjects'.<br />
.<br />
.<br />
How I can read Such a thing with C# Windows Application ...
I need a hint , don't bother your self for writting a code ,
But I will be happy if you did ...
Kimd regards
Thank in Advance
I know nothing , I know nothing ...
|
|
|
|
|
Hi,
if you launch the analyzer from within a .NET app (using Process.Start), you can catch the output and error streams, and deal with their content any way you see fit.
In general the correct way is by using three threads: one reading the output stream, one reading the error stream, and one orchestrating the launch and the termination; something the MS examples fail to illustrate.
For fast jobs without much output, you can do without it all, just ReadToEnd on both streams (which means you will get output only when all is done).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: if you launch the analyzer from within a .NET app (using Process.Start), you can catch the output and error streams, and deal with their content any way you see fit.
Correct me if I am wrong - Analyzer is not a console application. So how can you predict where this output message is coming and read only that portion from your application? I don't think it is possible.
Any thoughts?
|
|
|
|
|
Oh.
If it is a WinForm app, one can always try and get the text from the Control that holds whatever is relevant... (using some P/Invoke that is).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Have you tried executing that command using command.ExecuteReader() and look in the reader?
|
|
|
|
|
Hi, I know it was a long time , But i didn't forget to thank you , for your help ....
-----
I found the solution for my question , and I will posted it here ...
may be this piece of code will help other people ...
<br />
public void ApplySqlInfo()<br />
{<br />
SqlCon.InfoMessage += new SqlInfoMessageEventHandler(SqlCon_InfoMessage);<br />
SqlCon.FireInfoMessageEventOnUserErrors = true;<br />
}<br />
<br />
public void SqlCon_InfoMessage(object sender, SqlInfoMessageEventArgs e)<br />
{<br />
Console.Writeline(e.Message);<br />
}
thank you ...
I know nothing , I know nothing ...
|
|
|
|
|
Using Vista Home Premium - everything up to date.
I'm the Admin and sole user of this machine.
Downloaded C# Express.
Tried to create new project and got this error msg: "Required registry access is not allowed"
Could not create the project.
Reinstalled C# and tried again. Same result.
Been using VB.net Express since '05 and never saw this error before.
Any ideas?
|
|
|
|
|
Hi,
Visual Studio Express edition works fine for me under Vista Home Premium (C#, VB.NET, C++/CLI).
I googled Visual "Required registry access is not allowed" and found some 12 hits indicating you are not alone, unfortunately the promising Microsoft links all were broken...
There was one hint: disabling UAC, then re-enabling UAC (may take two reboots); everything else was changing lots of things in the registry...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Tried playing with the UAC but the problem persists. I also found a lot of broken links in the Questions section of the C# documentation.
From what I've seen, MS is as clueless about it as I am. Not good.
|
|
|
|
|
Run Visual Studio As Administrator.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: Run Visual Studio As Administrator.
According to the title bar of C#, that's what I'm doing - it says "(Administrator)".
|
|
|
|
|
I have some place in my code that i update my database(using Access db).
After i did this update - i try to get from some other place in my code the fresh data from this database.
For some reason i see that i get the old database data (i get the data before i update this database). But when i add some sleeping time (Thread.Sleep(5000)) before getting the fresh data i see that the data was update correctly.
How can i fix this problem ?
How can i know if the update of the database table was done ?
|
|
|
|
|
Are you using a separate thread to update the database.
If so, Use ManualResetEvent object to Set when update is successfully done.
And in the main thread use WaitOne function to wait until the child thread finishes its job.
You can also use Thread.Join to do this as well.
|
|
|
|
|
No,
In my application i have only one thread, so its does not look like thread synchronize problem.
|
|
|
|