|
Tis is working if the file is in my hard disk itself.
but not when it comes to server. If i map the server i can search.like
y:\\my folder\\myfolder
am tring to make an exe. different people will map to different drive.
so i cant give like that.should give like \\server\\serverfolde\\folder\\
|
|
|
|
|
Well, that will never work because a server must start with a double slash, so in your syntax this would be \\\\server\\serverfolde\\folder\\. You can, of course, prefix this with the @ sign so this becomes @"\\server\serverfolde\folder\".
Now, your application will need to have permissions to work with these folders - make sure that it has the permissions to do this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi
you can take the toolbox from openfiledialogbox1
|
|
|
|
|
I am tring to make an exe.
|
|
|
|
|
Hi,
I want to delete data from datbase by entering a year in text box. If the there no data then i want to show "the selected date does not exist". How can i do this? pls help me?
Please write code here........................
|
|
|
|
|
It should look something like this.
SqlConnection con = new SqlConnection(connecitonstring);
SqlCommand cmd = new SqlCommand("delete from table where year = @year",con);
cmd.Parameters.Add("@year",SqlDbType.Int).Value = int.Parse(TextBox1.Text);
if(cmd.ExecuteNonQuery() > 0)
{
Console.WriteLine("Record deleted successfully");
}
else
{
Console.WriteLine("No data found");
}
|
|
|
|
|
in select statement
strdelete="delete from tablename where datefield='date'
objsqlconn=new sqlconnection("user id=sa;password=;data source=servername")
objsqlconn.open
try
Dim vbmsg As String
vbmsg = MessageBox.Show("Are u sure to delete this record", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
If vbmsg = vbYes Then
strdelete = "delete from tablename where datefield='date'"
objsqlcmd = New sqlcommand(strdelete, objsqlconn)
objsqlcmd.executenonquery()
Else
MessageBox.Show("There is no field exits")
End If
catch (ex as exception)
exception(ex.message)
end try
|
|
|
|
|
|
rohitsrivastava wrote: yes
|
|
|
|
|
Why do I get the feeling the OP is going to copy'n'paste the code thrown at him and wonder why it doesn't work?
|
|
|
|
|
How to Fill Combo Box From SQL2000 Tables
SAS
|
|
|
|
|
SqlCommand cmd = new SqlCommand("SELECT [field] FROM table",connection);
SqlDataReader dataReader = cmd.ExecuteDataReader();
while(dataReader.Read())
{
comboBox1.Items.Add(new llistItem(dataRead[0],dataRead[0]);
}
dataRead.Close();
Hope this helps
|
|
|
|
|
hi this is the coding to fill the combo
strselect="select fieldname from tablename "
objsqlconn=new sqlconnection("userid=sa;password=;data source=servername")
objsqlconn.open()
objdataset=new dataset
objsqlcmd=new sqlcommand(strselect,objsqlconn)
objsqldataadapter=new sqldataadapter(objsqlcmd)
objsqldataadapter.fill(objdataset,"Tablename")
cmbname.datasourc=objdataset.table("Tablename")
cmbname.displaymember="Fieldname"
cmbname.displayvalue="fieldname"
this is how to fill the combo
have a nice day
|
|
|
|
|
when I iterate through form controls and their child controls
it works fine for every thing else expect when it comes to menu items it only returns only
the top item and not the child ones
the code I am using is
void ModifyControls(Control.ControlCollection ControlCollection)
{
for (int i = 0; i < ControlCollection.Count; i++)
{
if (ControlCollection[i].GetType() != typeof(Menu))
{
Array.Resize(ref Controls, Controls.Length + 1);
Controls[Controls.Length - 1] = new MyControls(ControlCollection[i]);
Controls[Controls.Length - 1].SaveFormating();
ModifyControls(ControlCollection[i].Controls);
}
}
}
Thanks and Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Greetings Amar,
If you look at how the MenuStrip control works you will notice that it houses a different type of collection, the ToolStripItemCollection in its MenuStrip.Items property. You need to iterate each ToolStripMenuItem in that collection to get its children.
After that, the ToolStripMenuItem has another ToolStripItemCollection in it's DropDownItems property, you now need to iterate through this collection to get it's children and so forth... consider the following example:
<br />
void ListControls(Control parentControl)<br />
{<br />
foreach (Control control in parentControl.Controls)<br />
{<br />
MessageBox.Show("Control Type : " + control.GetType().ToString() + "\n" +<br />
"Has Children : " + (control.Controls.Count > 0 ? "Yes" : "No") + "\n");<br />
<br />
if (control.Controls.Count > 0)<br />
{<br />
this.ListControls(control);<br />
}<br />
<br />
if (control.GetType() == typeof(MenuStrip))<br />
{<br />
foreach (ToolStripMenuItem toolStripMenuItem in ((MenuStrip)control).Items)<br />
{<br />
MessageBox.Show("---> Menu Strip '" + ((MenuStrip)control).Text + "' has '" + toolStripMenuItem.Text + "' as a child item.");<br />
if (toolStripMenuItem.DropDownItems.Count > 0)<br />
{<br />
}<br />
}<br />
}<br />
}<br />
}<br />
Basically, the MenuStrip needs to be treated like a TreeView as it can contain a complex hierarchy. I hope this helps... Have a great weekend!
Fernando Mendes
Senior .NET Developer, Architect
|
|
|
|
|
thanks for the help
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
In my application I need to use telnet to execute some commands so please help me to this.
How to connect to telnet and how to execute the commands in c#.net
Please help me on this
Thanks in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
Check this. http://www.activexperts.com/activsocket/howto/telnet/aspnetc/
|
|
|
|
|
Hope you google before you post question next time
|
|
|
|
|
I use System.Net.Sockets.TcpClient and System.Net.Sockets.NetworkStream.
System.Net.Sockets.TcpClient socket = new System.Net.Sockets.TcpClient ( Host , Port ) ;
socket.NoDelay = true ;
System.Net.Sockets.NetworkStream stream = socket.GetStream() ;
|
|
|
|
|
hi
in my code, i am saying
button.enabled = false;
...
...
...
...
progressbar.performstep();
label.text = "Pass";
button.enabled = true;
the button is grayed out during this, but if i have clicked during this, it takes the click event after "Pass" is displayed.
how do i prevent this? i need an urgent solution. please see if anyone can help me with some suggestion.
thanks.
|
|
|
|
|
What you exactly want button click will be fired after the text chenges to pass because you have enabled the button.
|
|
|
|
|
i am clicking the button before the text changes to pass.
|
|
|
|
|
Hi
In a separate thread, check the messages in application queues parallely.
If any message of button click comes and you are doing "pass" processing work
delete that message from application quese. Size of application queue would be 8.
|
|
|
|
|
Can anyone tell me how I can have a control tht I don't want other classes to inherit?
I have a base class and the child class needs to inherit but I don't want it to inherit one of the comboboxes. I need to delete it.
I tried to go into the designer class and declare protected but it still inherits.
Thank you
Sianny aka Sharny
|
|
|
|