|
protected void mouseMoved(object sender, MouseEventArgs e) {
if ((e.Button & MouseButtons.Left)!=0) {
// ...
} else if ((e.Button & MouseButtons.Right)!=0) {
// ...
}
}
Luc Pattyn
|
|
|
|
|
I forgot the parantheses around the (a & b) ... thanks!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify! || Fold With Us! || sighist
|
|
|
|
|
The enum really should have the [Flags] attribute, which tells the compiler that all of the values are supposed to be unique and provides a few other subtle runtime differences.
The best way to test to see if a particular value has been set is:
FileInfo info = new FileInfo(@"c:\windows\explorer.exe");
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
}
else
{
} .NET does allow you to treat an enum without the [Flags] attribute as if it were a flags enum to some extent, but it isn't recommended. If at some point the language or the compiler rules change, using an enum in this way without the [Flags] attribute could generate a compiler warning or error.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I can display results of a view I created in Sql server on a dataGrid,how would I display the same result on a txtBox ???
aPerfectTool
|
|
|
|
|
Hi
I think you want to access database tables field to show in textbox.
If below code is not your answer contact me:
SqlConnction cnn = new SqlConnection("Data Source=YourCopmputerName;Initial Catalog=YouDatabaseName;User Id=databaseUserName;Password=DatabasePassword");<br />
string strSql="SELECT id,name FROM Table1";<br />
DataSet ds = new DataSet();<br />
SqlDataAdapter da = new SqlDataAdapter(strSql,cnn);<br />
da.fill(ds,"Table1");<br />
if (ds.Tables[0].Rows.Count != 0)<br />
{<br />
TextBox1.Text = ds.Tables[0].Rows[0][1].toString();<br />
}<br />
This code get "name" column of tables from first row. you can access another cells by changing array index.
Bye
|
|
|
|
|
Hi,
I think U can achieve this in two ways.
1) Command.Text = "SELECT * FROM UR View Name (Nested of Table Name)"
2) Create one store Proc, Let the Store Proc intern selects view data by executing SELECT * FROM UR View Name.
For binding and displaying on Data Grid follow normal method.
Happy Coding
Gowda
|
|
|
|
|
Thanks guys, I got it going, your reponse helped me alot
aPerfectTool
|
|
|
|
|
hi
i want to write database application with c# 2005 and i want to set password to sqlserver 2005 database that users can not access to tables,views,....
but .. how to do ??
thanks
|
|
|
|
|
Hi
You can do this in the target system which you want to install your program on it.
But anybody can stop the sqlserver and take a copy of your database and then attach it to his/her sqlserver on another system without knowing username and password!!
I want to say it's not a cool way.
Do this to set a password to your database:
1-Open SqlServer and in Object explorer expand Security\Logins
2-Right Click and Logins and choose "New Login..."
3-In Login - New window type a LoginName and choose "Sql Server Authentication" and type password and uncheck checkboxes unless "Enforce password Policy" and Click "Ok "
4-Delete "BUILTIN\Administrator"
Now you have set password to sqlServer 2005
To set database password:
1-Expand your database and goto Security\Users
2-Right click on Users and select "New User..."
3-Type username and for import user click on button "..." front of "Login Name" and browse your user
4-Choose "db_owner" from below listbox
5-Press ok
I wish this is usefull
For more information goto:
http://forums.microsoft.com/MSDN/showpost.aspx?postid=672105&siteid=1[^]
This was my question in Msdn forum
Bye
|
|
|
|
|
main points to keep in mind in making chess in c#.
rao nasir ali khan
|
|
|
|
|
|
Excellent answer !!
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello,
I am using properties from Properties.Settings.Default.* in my background worker thread. I was wondering if they are thread safe or not ? moreover if two threads try to read the same settings value at the same time, (NOT WRITE, just READ) is there any chance that my application will crash throwing exception ?
Thanks
|
|
|
|
|
Any shared resource that is read-only (that is, no threads are writing to the resource) is inherently thread safe. So unless you've got another thread writing to the settings, yes, 2 background threads reading the settings is safe.
|
|
|
|
|
Hi.
Thanks for your reply.
Regards
|
|
|
|
|
My application accepts single string databaseaddress.
I think the best form for this is
servername:port/databasename
parts other than servername may be missing. So legal forms are also
servername
servername:port
servername/databasename
samples:
143.44.454.45:33/mydb
myhost@mycomp.com
myhost@mycomp.com/mydb
How to extract servername, port and databasename to separate variables ?
servername, port and databasename does not contain : and / characters.
There is no need for syntax check.
|
|
|
|
|
I think System.Uri.TryCreate method will work for you.
|
|
|
|
|
i am working on a Point of sales application in C#. I want to redirect the values to the pos device connected to LPT1. Can anyone tell me how i can do this.
Thanks for your help
Regards
Hari
rkharikrishnan.bizhat.com
|
|
|
|
|
Isn't LPT1: just printing it?
|
|
|
|
|
You can connect arbitary devices to the parallel port, not just old printers.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Of course you can. I remember the old ZIP drives that hooked up to the parallel port and took forever to read and write.
My message seemed to be truncated (or I just forgot to hit update ). My point is that when you connect a device to the port, it will need some kind of driver. Then you can interface with that driver.
|
|
|
|
|
VS05 provides a class for the parallel port. IIRC it's in the system.io.ports namespace that should allow you to write to it. If you're using VS02 or 03, you'll have to google up a 3rd party implementation. Try the articles here as a starting point.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Thanks for the reply. i tried using system.io.ports namespace. But its showing only serial ports data. What should i do to send to both com1 and LPT1 ports? How can i check whether it is open?
Regards
Hari
|
|
|
|
|
I developed an Add-in for Outlook 2003 with Visual Studio 2005 Team Suite.
My solution was created via:
Other Project Types -> Extensibility -> Shared Add-in
And I selected support for Microsoft Outlook.
Question 1:
I uncheched all the "Exclude" option of the assemblies in the Setup Project and builded it successfully.
The Add-in installed and ran well in another computer which had also VS 2005 Team Suite on it. However, on a third computer, which only had .NET Framework 2.0 but not VS 2005, the Add-in installed normally but did not load when Outlook started. What's the problem?
Question 2:
My CommandBarButton runs only a few times.
I added a CommandBarPopup to the Main Menu and then added a MsoControlType.msoControlButton to the popup. In the ClickEventHandler of the button, a Windows Form object is created and shown.
The problem is, each time I start Outlook, the button is available for only a few times, usually 2-3 times, sometimes only once. Afterwards it becomes unavailable at all. It gives no response when I click it.
Some of the codes are as follows:
//Acquire the "Menu Bar" and create a new control on it
menuBar = ((Outlook.Application)applicationObject).ActiveExplorer().CommandBars["Menu Bar"];
commandBarControl_CM = menuBar.Controls.Add(MsoControlType.msoControlPopup, 1, "", 6, true);
commandBarControl_CM.Visible = true;
commandBarControl_CM.Caption = "Sychronization";
//Add buttons to the newly created control
CommandBarPopup commandBarPopup_CM = (CommandBarPopup)commandBarControl_CM;
CommandBarControl commandBarControl_SI = commandBarPopup_CM.CommandBar.Controls.Add(
MsoControlType.msoControlButton, 1, "", 1, true);
commandBarControl_SI.Visible = true;
commandBarControl_SI.Caption = "Calendar Sychronization";
//Add button event handlers
CommandBarButton button_showinfo = (CommandBarButton)commandBarControl_SI;
button_showinfo.Click += new _CommandBarButtonEvents_ClickEventHandler(button_showinfo_Click);
private void button_showinfo_Click(CommandBarButton Ctrl, ref Boolean CancelDefault)
{
System.Windows.Forms.Form form_CalMng = new Form_CalMng();
form_CalMng.Show();
}
|
|
|
|
|
Question 2 has been solved. The button object has to be declared at class level.
But help me with Question 1, please!
|
|
|
|