|
He has to have administrator privileges. How much more clear could Vista be about that?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
As John said you need to give your program administrator rights to do this.
This can be done in vs2008 by setting the UAC settings in your project settings (application tab, 'view uac settings' button).
This will however have the effect that every time the user starts the program vista will ask the user if he is sure that he wants to start the program since it requires administrator rights.
But why would you want to give the user the possibility to delete files in these folders? They are protected for a reason.
|
|
|
|
|
Thank you for your valuable help
But why would you want to give the user the possibility to delete files in these folders? They are protected for a reason.
Actually my application is similar to windows explorer, a file management tool, hence i required this functionality.
RN Softech is a goan software development company, based at Goa, India.
|
|
|
|
|
I am writing a database application using Csharp. The database can be access, sql server whatever.
I have 100 variables in one database table. The variable names are V1, V2,V3,...,V100.
I put 100 textBox controls on one Form. I hope users input data through these textBoxes.
the codes look like:
V1=textBox1.text;
V2=textBox2.text;
V3=textBox3.text;
....
V100=textBox100.text;
This is just too tedious.
I want to do this way:
Make a 100 elements array V[i], and use a for loop;
for(int i=0;i<100;i++)
{
V[i]=textBox[i].text;
}
I can do this in SAS program using Marco variable.I am wondering if I can do this in csharp.
Thanks.
|
|
|
|
|
for (int i=1; (i <= 100); i++) {
TextBox t = getControlByName (String.Format ("textBox{0}", i)) as TextBox;
if (t != null)
V[i] = t.Text;
} For an example of getControlByName() see this[^] article.
/ravi
|
|
|
|
|
Thank you Ravi, would you like to change the vb.net function to a csharp function?
|
|
|
|
|
TextBox textBoxes = new TextBox[100];
for(int i=0; i<textboxes.length;>{
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
private void CreateTextBoxes()
{
for (int counter = 0; counter <= NumberOfControls; counter++)
{
TextBox tb = new TextBox();
tb.Width = 250;
tb.Height = 60;
tb.TextMode = TextBoxMode.MultiLine;
tb.ID = "TextBoxID" + (counter + 1).ToString();
// add some dummy data to textboxes
tb.Text = "This is textbox " + counter + " data";
phTextBoxes.Controls.Add(tb);
phTextBoxes.Controls.Add(new LiteralControl(" "));
}
}
In CreateTextBoxes method I loop through ‘n’ numbers of controls that we wants to create dynamically in phTextBoxes placeholder.
// Add DropDownList Control to Placeholder
private void CreateDropDownBoxes(DataTable dtTable)
{
for (int counter = 0; counter <= NumberOfControls; counter++)
{
DropDownList ddl = new DropDownList();
ddl.ID = "DropDownListID" + (counter + 1).ToString();
int nTotalRecords = dtTable.Rows.Count;
for (int i = 0; i < nTotalRecords; i++)
{
ddl.Items.Add(dtTable.Rows[i]["item"].ToString());
}
phDropDownLists.Controls.Add(ddl);
phDropDownLists.Controls.Add(new LiteralControl("
"));
}
}
In CreateDropDownBoxes method I have done the same thing by looping through ‘n’ numbers of controls, the value of ‘n’ which was stored in ViewState, and create them in a phDropDownLists placeholder control.
// Create TextBoxes and DropDownList data here on PostBack.
protected override void CreateChildControls()
{
// Here we are recreating controls to persist the ViewState on every post back
if(Page.IsPostBack)
{
CreateTextBoxes();
InitializeDropDownBoxes();
}
// Create these conrols when asp.net page is created
else
{
CreateTextBoxes();
InitializeDropDownBoxes();
// Increase the control value to 1
this.NumberOfControls = 1;
}
}
CreateChildControls method, here we are recreating control on every PostBack. If the page is created the first time we just create these controls and save 1 in the ViewState so we know that we have created these controls and assigned the controls id to 1.
// Increase the counter when button is clicked and add to view state
private void btnAnotherRequest_Click(object sender, System.EventArgs e)
{
NumberOfControls += 1;
}
In button event handler we just increase the counter by 1, and save its value to ViewState for later retrieval.
Once we have created these controls on ASP.NET page, retrieving data from these dynamically created controls is easy by using FindControl method.
// Read DropDownList Data
private void ReadDropDownLists()
{
int n = this.NumberOfControls;
for (int i = 0; i<n;>{
string DropDownListName = "DropDownListID" + (i+1).ToString();
DropDownList ddl = phDropDownLists.FindControl(DropDownListName) as DropDownList;
lTextData.Text += ddl.SelectedValue + " ";
}
}
And
// Read TextBoxes Data
private void ReadTextBoxes()
{
int n = this.NumberOfControls;
for (int i = 0; i<n;>{
string boxName = "TextBoxID" + (i+1).ToString();
TextBox tb = phTextBoxes.FindControl(boxName) as TextBox;
lTextData.Text += tb.Text + (" ");
}
}
|
|
|
|
|
The ROBOTIX team of IIT Kharagpur presents - Micromouse4d in MSRS!!!
http://robotix.in/acc_umouse4d
This is completely an ONLINE event where all you have to do is code your algorithm in an already exisiting simulator and reach the centre of the maze in the fastest time!!!! Hurry, deadlines are fast approaching. Register and compete from the comfort of your own room to beat the rest for prizes over $1000!
|
|
|
|
|
What is this?Why are you here?This is not a page for advertisement.
Cheers!!
Brij
|
|
|
|
|
Hi
I am using C# and Visual Studio 2005 to develop a Windows Application. I use the designer to bind a DataGridView to a table in a MS Access database.
When I use the designer the following code is automatically generated in the Form_Load method:
this.procPatientList_AllInfoTableAdapter.Fill(this.patientStatusDataSet.procPatientList_AllInfo);
I try to update the database when changes have been made to the data in the DataGridView, but cannot find what to use or how to do it. In the past I used to write my own code and could do updates. I am trying now to learn about the built-in functionality, but I am struggling.
Neither procPatientList_AllInfoTableAdapter nor patientStatusDataSet has any Update methods.
Any assistance will be appreciated.
Thanks.
Kobus
|
|
|
|
|
See this[^] or you can search in google with keyword CommandBuilder
|
|
|
|
|
Dave Kreskowiak(CodeProject) tought me to Stop using wizards when am doing my Daatabase work.
wizards have limitation and its not easy to debug if you did not write the code for yourself. i suggest you start writting your data layer so that you can see what is the Problem. as you said you use to write the code your self, why did you stop because its the best way of doing things, i have an Article that can get you started on how to update a Datagrid.
http://www.codeproject.com/KB/cs/N-Tier22.aspx[^]
Hope i Helped
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/SQL7/2000/2005/2008
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@its.co.za
|
|
|
|
|
hello sir
i want a c# code for merge two individual picture in to asingle picturebox. Then the images are merge in one is back image and next one is fore image to differetiate these two images
please help me
ok bye
|
|
|
|
|
jaraldumary wrote: i want a c# code
I want candy.
|
|
|
|
|
You have to create a third Image painting both of your source images into this new image, then you can set the PictureBox to this third image.
No, I can't write the code for you. I simply don't have the time right now.
|
|
|
|
|
Hi all,
I want to change the paper settings to customized one based on the culture info, I mean for now it is coming as A4 by default. For eg, if they try to do print using some other culture info, it should change to letter formate, how to set like that.
Please suggest me
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
hello sir
i want a sample code for the above things (merge two images)
|
|
|
|
|
Been a while since I worked with this but from what I remember you can pas a printersettings and a pagesettings object with the report.open method.
See if that helps you.
|
|
|
|
|
Thankyou very much for your suggestion. But please explain me with a sample.
THank you again
Know is Drop, Unknown is Ocean
|
|
|
|
|
As I said in my original reply it's been a while so I don't know the exact code.
But normally you should have an instance of your report
and that instance should have a open method in which you can pass the objects pagesettings and printersettings
pagesettings[^]
printersettings[^]
|
|
|
|
|
Dear all,
I'm trying to get my computer to listen on a port and pass on the received data ( after some modification ) over Multicast. I'm receiving data on the socket every second. I wrote the code below and it works perfect.
The problem that I require some assistance with is pretty simply. Everytime a string of data is received, the socket is closed and new socket is opened to wait for the next string. When the next string of data comes in, it gets processed and the socket is closed again. This means that after a period of time, lots of socket connections are made. One of them is active and the others are in a TIME_WAIT state ( and that list keeps growing ) Is there a way around this ?
Int32 port = 31008;
IPAddress localAddr = IPAddress.Any;
server = new TcpListener(localAddr, port);
server.Start();
Byte[] bytes = new Byte[256];
String data = null;
while (true)
{
client = server.AcceptTcpClient();
data = null;
NetworkStream stream = client.GetStream();
int i;
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
{
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
data = data.ToUpper();
byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);
SendMulticast(MultiCastIP, MultiCastPort, msg);
}
client.Close();
}
kind regards,
Rick
|
|
|
|
|
The TIME_WAIT state for a period of time is normal/default socket behavior.
If you're absolutely sure all data is sent, then you may be able to set the
LingerState to on/0sec:
LingerOption lingerOption = new LingerOption (true, 0);
client.LingerState = lingerOption;
You also should call Close() on your NetworkStream
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
My question is that.. Report.rdlc is class ? how to i format the report at runtime such as i want change the fontstyle before print the report while runing the program.
thanks.
|
|
|
|
|
Hi,
as the title indicates I want to mark a field in a child class with a NonSerialized attribute so that it won't be serialized. Simply put:
[Serializable]
class Parent
{
protected int SomeField;
}
[Serializable]
class Child : Parent
{
[NonSerialized]
protected int SomeField;
}
Of course this does not work, but also the new keyword does not help me because it only hides the field and does not overwrite it. Is there any other way to achieve the desired effect?
Regards
Dust Signs
The number you dialed is imaginary. Please turn your phone by 90 degrees and try again
|
|
|
|