|
Manilipa wrote: please send me code sample for uploading a video in c# .net
Sure.
public interface IUpload
{
void UploadItem(Stream value);
}
public class UploadVideo : IUpload
{
public void UploadItem(Stream value)
{
SaveStream(value);
}
private void SaveStream(Stream value)
{
}
} There - all you have to do is provide some code to write the stream to whatever medium you're saving it to, oh and a mechanism to get the data into your UploadVideo class, but that's trivial implementation detail. I'm sure a rocket scientist like yourself won't have any problem with this.
|
|
|
|
|
Maybe you should read the first article and adapter yourself to ask question properly.
LuckyBoy
|
|
|
|
|
Hi,
please send me code sample of email functionality with attachment in c#.net
|
|
|
|
|
Is Google on holiday today?
only two letters away from being an asset
|
|
|
|
|
|
|
While that is seriously cool, I don't think you're doing him any favors by further automating it.
"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
|
|
|
|
|
Oh, that's simple, all you need to do is to write a system mouse hook, then just grab the mouse, open a mail client, attach a file and click the send button.
But hey, that's all in code
Regards,
Lev
|
|
|
|
|
Hi,
I'm writing a c# application that imports a c++ dll.
The next code is in the c++ dll:
// Maximal size of allowed log
#define ASTRO_MAX_LOG_LENGTH 1000
I need to use this defined value in my c# code.
How can I do that? Is there some way to use DllImport for a defined value?
Thnks
|
|
|
|
|
No, there isn't. You'll have to define these constants in your C# code yourself.
|
|
|
|
|
I want enumerate list of files and folders of intranet network folder, I tried using directoryInfo and fileInfo, but unable to get list.
I tried with following code
DirectoryInfo di = new DirectoryInfo(@"\\officepc\myprograms")
This code doesnt works.
when i paste \\officepc\myprograms in windows explorer i can see files.
RN Softech is a goan software development company, based at Goa, India.
|
|
|
|
|
|
Hi
I am able to access the shared folders fromn the same.When u access it from explorer ,whether it asks any password or not?
One more thing,After instantiating DirectoryInfo use exists property to check whether it has read the folder or not as
di.Exists
if true then enumerate it else there is some problem in reading.
Cheers!!
Brij
|
|
|
|
|
Rajesh Naik Ponda Goa wrote: This code doesnt works.
A little more explanation might helpful. It doesn't return results, it throws and exception, "doesn't work" is a bit vague?
only two letters away from being an asset
|
|
|
|
|
Hi,
I am using below code to delete a file from my application which works fine for some folders. When I try to delete file from system folders such as \program files\.. or windows\... folder i get access denied. What are the changes required so that whenever user tries to delete file from system folder, vista will show security popup which asks administration password which it normally does for system folders.
Here is the code..
if (File.Exists(Path.Combine(tstxUrl.Text, lvItm.Text)))
{
File.Delete(Path.Combine(tstxUrl.Text, lvItm.Text));
}
Thanks
RN Softech is a goan software development company, based at Goa, India.
|
|
|
|
|
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
|
|
|
|