|
Look at the ServiceController class in System.ServiceProcess.dll
|
|
|
|
|
Regex r = new Regex(@"[^t^\s^\d^x^X]|[^d^\s^\d^x^X]", RegexOptions.IgnoreCase|RegexOptions.Compiled);
what does this regular expression means
|
|
|
|
|
sarojkumarjena wrote: what does this regular expression means
I suspect an error, all those '^' are wrong (except the 1st 2 occuences). But here's the break down:
Match one character of ( (anything but t, ^, whitespace, number, x, X) or (anything but d, ^, whitespace, number, x, X) ).
See, its totally 'stupid'.
Do yourself a favour, and learn RegEx, much easier to write than to read IMO
|
|
|
|
|
int i=20;
How shall I show a value of i in message box
|
|
|
|
|
MessageBox.Show(i.ToString());
|
|
|
|
|
In order to show the value of i, you can use following:
MessageBox.Show(i.ToString());
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi
I am developing Windows Mobile Application using c#, SQLLite DataBase,I am using .NETWrapper for SQLLite, Iam able to Create Tables, but I wanted to create only once,How to check whether the Table is already created?
I didnt find any samples in Website.
Please help me
Thanks
|
|
|
|
|
Try "Select Count(*) from Mytable"
If you get an exception (or no such table error) then create it, if it succeeds, then move on to the next table.
|
|
|
|
|
Thanks for your prompt reply, I will try it out.
|
|
|
|
|
Use Transact SQL..
Something like.
IF 'USERS' NOT EXIST THEN CREATE TABLE ( ... )
Hopes his helps...
.NET Rules
|
|
|
|
|
|
Sorry.. typo mistake
'USERS' is the table..
Also if you are using an ms sql db, then you can also do something like this
IF EXISTS (SELECT 1
FROM sysobjects
WHERE xtype='u' AND name='tablename')
--- 'tablename exists.'
ELSE
--- 'tablename does not exist.'
Dropping Table
DROP TABLE SALARY IF EXIST
then create it again
CREATE TABLE SALARY ( ... )
There are many ways to solve what you are trying to do..
.NET Rules
|
|
|
|
|
I am writing code that will synch 2 databases. This process can take time and I want the ability cancel the process once it is started. The process is started by the timer when a dialog box is opened. The dialog box has a cancel button, but it doesn't work even if I DoEvents() on the next update of the progress bars. Is there a way to attach a Listner or something that does not require creation of second thread? The biggest issue is that a couple of the database calls can result in blocking while it waits for results. By the way, if this has been answered before sorry, I tried several queries and could have missed the necessary queries. Thanks.
Leo T. Smith
|
|
|
|
|
If you are using 2.0 then simple create a backgroundworker and enable AllowCancel. Have this start rather than the timer when the form is loaded.
If you are not using 2.0, WHY NOT!!!
Seriously, if you can't use 2.0 then you have to do the hard work of creating a thread and stopping the sync. Sorry but creating a seperate thread to run it is the only way to get the functionality while remaining responsive the the UI.
only two letters away from being an asset
|
|
|
|
|
Hi all, using this code I hoped that the phone nuber would show up formatted but it is not for some reason, it still shows unformatted. The numberComboBox is a Winform combo box that is part of a custom control. Everything works well except for the formatting. I also tried "0: (###) ###-####" as the format string but no go! The UnFrmtPhoneNumber member is a string column containing unformatted numbers like 5145555555.
Anyone knows why ?
Thanks for any help
public BindingSource Binding
{
set
{
numberComboBox.DataSource = value;
numberComboBox.DisplayMember = "UnFrmtPhoneNumber";
numberComboBox.ValueMember = "PhoneID";
numberComboBox.FormattingEnabled = true;
numberComboBox.FormatString = "(###) ###-####";
}
}
|
|
|
|
|
That depends on the data type of the phone number. If it's a string, then supplying a FormatString will do nothing because it only works with numeric values, not strings. If the phone number is stored as an Integer, it'll work just fine.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok I am working with the 2.0 Framework and I have a Windows Form with 2 DataGridViews. When a Row is Selected in both GridViews and a Toolbar Button pressed I am assigning Data From one to the other and vice-versa. I have the SelectionMode set to FullRow Selection.
Here is where the problem comes into play, if I update without the user moving the selected row in both datagridview controls the update doesnt see that anything has been modified. I have tried calling EndEdit on the GridView, but since the user didnt edit the Cell (I do with code), this doesnt make a difference. Is there a way to force the GridView to post its current changes so the Underlying DataTable thinks its been modified?
Thanks in Advance
Terance Emory
|
|
|
|
|
Ok figured it out in case someone else runs across this problem. I personally dont think there is a way to make a row accept changes without physically moving off the row. So what I did instead is update the underlying DataTable.
This might be a bit of a hack (meaning might be better way to do this), but all I did was pull the key values from the current row using a DataView I locate the DataRow in the DataTable and modify the value there instead of in the cells of the DataGridView. Worked like a charm.
I cant believe something so simple is so hard with this control, give me a method to tell the GridView "Hey Foo, this row is Dirty".
|
|
|
|
|
Hi guys;
I have a question; I am using SQL dataadapter to run a stored procedure of which I am filling the result into a dataset as follows:
DataSet ds=new DataSet();
adp.Fill(ds,"tbACJE");
then I am running the following code:
if(ds.Tables["tbACJE"].Rows.Count>1)
{
What I would like to do from there is to find/compare the sum of 2 columns. i.e CreditColumn and DebitColumn. Could you guys help me on how I could do that please.
Thanks in advance.
sasa
|
|
|
|
|
ds.Tables["tbACJE"].Compute("SUM(Credit + Debit)", "<filter>");
only two letters away from being an asset
|
|
|
|
|
Thanks Mark for your help.
I have another question please on this. After I get the sum; I would like to run and If/else statement where if Sum=0 than do nothing else Pass the Sum of Credit and pass the sum of debit.
By pass I mean
System.Data.DataRow rd= ds.Tables["tbACJE"].Rows[0];
Double fTemp= Double.Parse(rd[0].ToString()); //rd[0] is the Debit Column.
Please help.
sasa
|
|
|
|
|
I am creating a windows application from a pdf. Actually I am bringing a pdf document into a windows form as a background image and adding controls to be able to populate the form from a database. My goal is to be able to print a copy of the populated form and then save it as a pdf. Does anyone have an idea on how I can do this. Print the form or save as a pdf.
Thanks in advance!
|
|
|
|
|
|
I have this for an array of pictureboxes:
GradPic[i].MouseClick += new MouseEventHandler(GradPic_MouseClick);
GradPic[i].MouseDoubleClick += new MouseEventHandler(GradPic_MouseDoubleClick);
private void GradPic_MouseClick(object sender, MouseEventArgs e)
{
this.GradLabel[selectedGradLabel].ForeColor = System.Drawing.Color.Black;
for (int i = 0; i < GradPic.Length; i++)
{
if (GradPic[i] == (PictureBox)sender)
{
selectedGradLabel = i;
this.GradLabel[selectedGradLabel].ForeColor = System.Drawing.Color.Red;
}
}
}
private void GradPic_MouseDoubleClick(object sender, MouseEventArgs e)
{
for (int i = 0; i < GradPic.Length; i++)
{
if (GradPic[i] == (PictureBox)sender)
{
if (currentView == "Astronauts") ShowAstronautBio();
else ShowGraduateClassPhoto();
}
}
}
Which works fine. I have a similar approach to a different array of pictureboxes, only now the DOUBLECLICK event fires only if I rem out the mouseclick assignment. Anybody have any ideas?
ACThumbBox[i].MouseClick += new MouseEventHandler(ACThumbBox_MouseClick);
ACThumbBox[i].MouseDoubleClick += new MouseEventHandler(ACThumbBox_MouseDoubleClick);
private void ACThumbBox_MouseClick(object sender, MouseEventArgs e)
{
this.ACThumbBox[acGridCurrent].BorderStyle = BorderStyle.None;
for (int i = 0; i < ACThumbBox.Length; i++)
{
if (ACThumbBox[i] == (PictureBox)sender)
{
acGridCurrent = i;
this.ACThumbBox[acGridCurrent].BorderStyle = BorderStyle.FixedSingle;
}
}
}
private void ACThumbBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
DisplayAircraftWebPage();
}
|
|
|
|
|
Have you tried altering what the function does. Like comment out "DisplayAircraftWebPage();" and just putting instead a MessageBox.Show call to see if the event is the problem or whether the DisplayAircraftWebPage() method is the problem. Or you if the control is being designed, check to make sure all the designer event handlers are set to the proper event.
|
|
|
|