|
Awesome I think it might do the trick
|
|
|
|
|
But it is Embedded VC++ DLL. Isn't it?
|
|
|
|
|
how to open .csproj in xml file through C# code and add a file as a link
I want to add CommonFileInfo.cs in more than one project
for this i want to add "CommonFileInfo.cs" file as a link in project.
So I want to open every .csproj in xml file and add this code.
<compile include="..\Projects\CommonFileInfo.cs">
CommonFileInfo.cs
How to do this???
Thanks in Advance
-- modified at 8:28 Saturday 1st September, 2007
|
|
|
|
|
|
Dear friends,
I have Created a windows Service in .net 2005 to find the WMI Classes that are available in a system.
When I invoke this windows service through a web site
I could get all the WMI Classes available in my system.
But it throws an error “Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) “ Like this for the remote System.
Note: I have given the correct User name and Password.
And this same code works fine in windows application,console application and web site for the remote system and local system..
This is the Code:
private string[] GetClassesList(string sIPAddress, string sWMINameSpace, string sUserName, string sPassword, bool bRemoteSystem)
{
int queryClassCount = 0;
string[] aClassList = null;
ConnectionOptions cnnOptions = new ConnectionOptions();
ManagementObjectCollection objClassColl = null;
cnnOptions.Username = sUserName;
cnnOptions.Password = sPassword;
cnnOptions.Authentication = AuthenticationLevel.Packet;
ManagementObjectSearcher searcher = null;
try
{
if (bRemoteSystem)
{
searcher = new ManagementObjectSearcher(new ManagementScope(@"\\" + sIPAddress + @"\" + sWMINameSpace, cnnOptions),
new WqlObjectQuery("select * from meta_class"), null);
}
else
{
searcher = new ManagementObjectSearcher(new ManagementScope(sWMINameSpace),
new WqlObjectQuery("select * from meta_class"), null);
}
objClassColl = searcher.Get();
//aClassList = new string[objClassColl.Count+1];
}
catch (Exception me)
{
MessageBox.Show(me.Message);
}
Friends, Is there any problem in my code?
Any idea’s or Link
Help me
Thank u.
by
Joe
|
|
|
|
|
The account which runs this service must have sufficient privileges on the system that is being connected to.
|
|
|
|
|
Thanks for ur reply.
yes i have given the Administrator username and password of the remote system.
any other problem??
thank u
by
joe
|
|
|
|
|
As this forum is quite old but in case you need any help, let me know. We completed medium size internet projects where i troubleshoot all this.....
|
|
|
|
|
Hai
Thanks for u r reply.
plz give solution for this problem.
I've given administrator username and password.
it works fine for remote system when i execute as windows exe
but when i create as windows service it throws "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" error.
Thank u
by
joe
|
|
|
|
|
Hello friends,
Here is the coding of convertion of month to string its Showing
Month and Date ie "August 30"
I want only Month how can we get it.
Below coding is showing like that.
strmonth = dtNowMinusOne.ToString("M");
please give me a solution its urgent
thanks in advance
Kankeyan J
|
|
|
|
|
|
Is there any way to declare global variable in c# that can accessed by all class of application ??
|
|
|
|
|
Bhavesh Bagadiya wrote: declare global variable in c# that can accessed by all class of application
Anti-OOPs.
Use a static class that should be befitting your bill/requirement.
|
|
|
|
|
public static variables will do the trick;
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
There are no global variables in C#. You have to put the variables in a class.
You can make a static class with public static variables in it. Those are accessible from anywhere in your application. Also, it's obvious that the class is intended for this, as you can't create instances of a static class.
---
single minded; short sighted; long gone;
|
|
|
|
|
how can you make a static class?
and what is partial class?
|
|
|
|
|
XFighter wrote: how can you make a static class?
Create a class and make it static...
Example:
public static class Settings {
public static string AppName = "My Super Application";
public static string AppVersion = "0.9 beta";
}
XFighter wrote: what is partial class?
A partial class is a class that is partially defined in two different places, usually in two different files. This is regularly used when part of a class is auto generated, like a web page class.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi, is it possible to simulate mouse clicks in a windows form, though the form is hidden/invisible?
I want to write a kind of click bot for internet sites and because i can't directly access some elements from the site i want to simulate mouse clicks, but the form has to be hidden, so it doesn't disturb the user. is that possible?
greetz Knack
|
|
|
|
|
|
Add this line to the top of your codefile:
using System.Runtime.InteropServices;
Then add these lines of code after the open brace in Form1 (or whatever your form is called):
private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
<br />
[DllImport("user32.dll")]<br />
private static extern void mouse_event(<br />
UInt32 dwFlags,<br />
UInt32 dx,<br />
UInt32 dy,<br />
UInt32 dwData,<br />
IntPtr dwExtraInfo<br />
);
To simulate a left click, you would then use this code:
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, new System.IntPtr());
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new System.IntPtr());
And that's it!
- Virtual1ty
|
|
|
|
|
Dear all,
here i have done a grid node like user control for displaying the items in each and every page
in that grid i have a dropdown list for selecting the feature of the item . here i has to fetch the fetch the feature from database and based upon that i has to display.
the below i had written but it is not working
so please help me
Thanks and Regards
protected void gridnode1_SelectedIndexChanged(object sender, EventArgs e)
{
dsfeature = con.GiveDataSet("select features from b2bpattributes ,b2bproducts where b2bpattributes.productgroup in (select productgroup from b2bproducts where productid='" + str2 + "') and b2bpattributes.productid=b2bproducts.productid and b2bproducts.available='Online'");
//select features from b2bpattributes where productgroup in (select productgroup from b2bproducts where productid='" + str2 + "' and available='Online')");
if (dsfeature.Tables[0].Rows[0]["features"].ToString() != "")
{
if (dsfeature.Tables[0].Rows.Count != 1)
{
//lblfeature.Visible = false;
ddlfeature1.DataSource = dsfeature;
ddlfeature1.DataTextField = "features";
ddlfeature1.DataBind();
}
else
{
//lblfeature.Visible = true;
lblfeature.Text = dsfeature.Tables[0].Rows[0]["features"].ToString();
ddlfeature1.Visible = false;
//lblselect.Visible = false;
}
}
else
{
ddlfeature1.Visible = false;
//lblselect.Visible = false;
}
}
sai krishna
|
|
|
|
|
I recently read an article about how Passing data between forms.(http://www.codeproject.com/useritems/pass_data_between_forms.asp)
What it fails to explain(or I fail to understand) is how do I do it whilst I don't create objects of the form?
Here is the code below, abit long but simple...
I want data from the second form to be passed to the first form(then I could show it with labels)
[code]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutoDownloader
{
public partial class Form1 : Form
{
public Form1()
{
Initiailize();
}
public void Initiailize()
{
this.Width=800;
this.Height=400;
this.StartPosition= FormStartPosition.CenterScreen;
Button AddShow = new Button();
AddShow.Click+=new EventHandler(AddShow_Click);
AddShow.Top = 300;
AddShow.Left = 20;
AddShow.Width = 100;
AddShow.Text = "Add New Show";
this.Controls.Add(AddShow);
}
public void AddShow_Click(object sender, System.EventArgs e)
{
AddShowForm subform=new AddShowForm();
subform.Show();
}
}
public class AddShowForm : Form
{
Label NewShow = new Label();
Label DownloadDate = new Label();
Label DownloadTime = new Label();
Label DownloadWebsite = new Label();
TextBox tNewShow = new TextBox();
TextBox tDownloadDate = new TextBox();
TextBox tDownloadTime = new TextBox();
TextBox tDownloadWebsite = new TextBox();
Button Save = new Button();
Button CloseForm = new Button();
public AddShowForm()
{
Start();
}
public void Start()
{
this.Width = 600;
this.Height = 250;
this.StartPosition = FormStartPosition.CenterScreen;
NewShow.Left = 10;
DownloadDate.Left = 10;
DownloadTime.Left = 10;
DownloadWebsite.Left = 10;
NewShow.Top = 20;
DownloadDate.Top = 50;
DownloadTime.Top = 80;
DownloadWebsite.Top = 110;
tNewShow.Left = 330;
tDownloadDate.Left = 330;
tDownloadTime.Left = 330;
tDownloadWebsite.Left = 330;
tNewShow.Top = 20;
tDownloadDate.Top = 50;
tDownloadTime.Top = 80;
tDownloadWebsite.Top = 110;
NewShow.Width = 300;
DownloadDate.Width = 300;
DownloadTime.Width = 300;
DownloadWebsite.Width = 300;
CloseForm.Click += new EventHandler(CloseForm_Click);
Save.Click += new EventHandler(SaveData);
Save.Top =150;
Save.Left = 10;
CloseForm.Top = 150;
CloseForm.Left =100;
Save.Text = "Save Data";
CloseForm.Text = "Close";
NewShow.Text = "Enter the name of show to search:";
DownloadDate.Text = "Enter the date you'd like to download the show:";
DownloadTime.Text = "Enter the time you'd like to download the show:";
DownloadWebsite.Text = "Enter the name of website which you want to download from:";
this.Controls.Add(NewShow);
this.Controls.Add(DownloadDate);
this.Controls.Add(DownloadTime);
this.Controls.Add(DownloadWebsite);
this.Controls.Add(tNewShow);
this.Controls.Add(tDownloadDate);
this.Controls.Add(tDownloadTime);
this.Controls.Add(tDownloadWebsite);
this.Controls.Add(Save);
this.Controls.Add(CloseForm);
}
public void CloseForm_Click(object sender, System.EventArgs e)
{
this.Visible = false;
}
public void SaveData(object sender, System.EventArgs e)
{
this.BackColor = Color.Red;
}
}
}
[/code]
|
|
|
|
|
XFighter wrote: I recently read an article about how Passing data between forms.(http://www.codeproject.com/useritems/pass_data_between_forms.asp)
If it is an issue with an article, the best bet route should be to initiate a thread over the article's forum.
|
|
|
|
|
I am opening afile through
foreach(string eachfile in ArrayOfFile)
{
System.IO.StreamReader sr = new System.IO.StreamReader(eachfile,FileMode.Open,FileAccess.Read);
System.Text.StringBuilder strAllText = new System.Text.StringBuilder();
}
I want that if any one file is not access or not open then it will throw a error msg only and continue to read another file..
if anyone has solution then plz reply
|
|
|
|
|