|
Yes...
You can get the return value from Show() method.
for example :
DialogResult dialogResult = MessageBox.Show("My Text", "My Title", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if(dialogResult == DialogResult.OK)
{
}
else if(dialogResult == DialogResult.Cancel)
{
}
|
|
|
|
|
Hi,
this is simple. read this example from msdn
Private Sub ValidateUserEntry2()<br />
<br />
<br />
' Checks the value of the text.<br />
<br />
If ServerName.Text.Length = 0 Then<br />
<br />
' Initializes variables to pass to the MessageBox.Show method.<br />
<br />
Dim Message As String = "You did not enter a server name. Cancel this operation?"<br />
Dim Caption As String = "No Server Name Specified"<br />
Dim Buttons As Integer = MessageBoxButtons.YesNo<br />
<br />
Dim Result As DialogResult<br />
<br />
'Displays a MessageBox using the Question icon and specifying the No button as the default.<br />
<br />
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _<br />
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)<br />
<br />
<br />
' Gets the result of the MessageBox display.<br />
<br />
If Result = DialogResult.Yes Then<br />
<br />
' Closes the parent form.<br />
<br />
Me.Close()<br />
<br />
End If<br />
<br />
End If<br />
<br />
End Sub
Anant Y. Kulkarni
|
|
|
|
|
I need the control to mimic the functionality provided by OUTLOOK. i.e: the email can be grouped by DATE, FROM, TO etc. and each group can be collapsed and expanded to reveal more information.
So for example in our application...I want to see a list of clients grouped by CASE. every CASE group can be expanded to reveal the clients associated with that case
e.g:
===============================================
SURNAME ^ | NAME ^ | DATE ADDED
===============================================
- CASE A
Putter David 01 June 2006
Smith Kelly 24 May 2006
+ CASE B
+ CASE C
|
|
|
|
|
|
well listview 2.0 supports grouping but not expaned and collapse mode like you want. However, you use an off the shelf component called SandGrid it is produced by a company in the UK called DivElements. In my opinion this is a damn good component to use plus its very cheap. try http://www.divelements.co.uk/net/controls/sandgrid/
|
|
|
|
|
Thanks. How does one programmatically highlight or de-highlight a listview items which is sitting inside a listview control? i.e. what events get called
|
|
|
|
|
Is this possible to achieve without having tons of code for checking ms excel versions etc?
|
|
|
|
|
Just use the System.Threading.Proccess.Start () method.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
With that method I have to give directions to the .exe file if Im not mistaken. This is a problem since this is going to alot of clients...
|
|
|
|
|
No you just pass it the filename of your xls file and then the client's OS will open the file in the program that is registered to handle this files.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
sweet, it worked thanks alot.
|
|
|
|
|
Hi,
I don't know how to get IIS root path at win form project(c#).
example.
http://localhost/web-app
-->> I wanna get 'c:\Inetpub\web-app' in c# program.
pleases, write message
or
send email
thanks.
-- modified at 8:57 Wednesday 17th May, 2006
|
|
|
|
|
See MSDN for Page.MapPath()[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Not sure if this will work on a win forms project
|
|
|
|
|
I didn't notice.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
I'm using ASP.NET and C#.NET 2. I have to dynamically display all hubs for a given hub group. A user selects the hub group from a drop down, and all the related hubs load, with a textbox next to it. The id of the textbox will depend on the id of the hub, so if the hub ID is 2, then it's corresponding textbox name will be txtHub2.
This my table where I have a label control. The label control will contain all the <tr></tr> and <td></td>.
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<asp:Label id="lblHubCommissions" runat="server" />
</table>
In cboHubGroup_SelectedIndexChanged(object sender, EventArgs e) event handler I have the following:
string strHubs = string.Empty;
List<Hub> lstHubs = Hub.GetHubsByHubGroupID(Int32.Parse(cboHubGroup.SelectedValue));
foreach (Hub h in lstHubs)
{
strHubs = strHubs + "<tr>" +
"<td width=\"30%\">" + h.HubName + "</td>" +
"<td width=\"70%\">" + "<asp:TextBox id=\"txtHub" + h.HubID + "\" Columns=\"35\" MaxLength=\"50\" CssClass=\"InputText\" runat=\"server\" /><br />" + "</td>" +
"</tr>";
}
if (strHubs != string.Empty)
lblHubCommissions.Text = strHubs.Substring(0, strHubs.Length - 2);
else
lblHubCommissions.Text = "No available hubs.";
The textboxes don't wan't to display. But if I view the source then it is there. Why is this?
Regards,
ma se
(South Africa)
|
|
|
|
|
hi all,
i have 2 buttons on a simple form.
both do different things.
but i want button2 to be treated as if its clicked if i click on button1.
how can i do this ?
|
|
|
|
|
what i got is you want to click the button 2 when u click button 1 if its the case
then just call button two click event on the button1 click event
private void button1_click(Object Sender, Args e )
{
Button2_click(sender, e);
}
in heading you are saying enabling for enable u can use the property
button1.enabled=true or false.
hope this will help you.
Naveed Kamboh
|
|
|
|
|
What do you want exactly?
If you want to enable a button, just call button2.Enabled = true , where button2 is your button variable.
If you want to call the same code for button 1 and 2, just do something like this:
private void button1_Click(object sender, EventArgs e)
{
button2_Click(sender, e);
}
and vice versa.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
or
private void button1_Clicked(object sender, EventArgs e)
{
button2.PerformClick();
}
|
|
|
|
|
Sir,
if any one could tell me how to insert a row in the datagrid
dynamically. with the click of a button
and
if i have 5 rows in datagrid and i want to store all the rows in the database
how to do that
Thanks
Plese Read it
|
|
|
|
|
One of the simplest ways to do this is to insert a row into the data source that drives your grid. in the button click event, add a new row to your data source (not in the database, in memory) and rebind to the data grid. For example, if you were going to use a DataTable as your source:
DataRow newRow = myTable.NewRow();<br />
<br />
myTable.Rows.InsertAt(newRow,index);<br />
myGrid.DataSource = myTable;<br />
myGrid.DataBind();
This also gives you a placeholder to store the data that is being edited by your data grid (assuming your data grid is being used to edit data). When submitting multiple rows to a database, I will typically submit the data as XML to a stored procedure and then let the stored procedure handle the inserts/updates. This assumes you are using MS SQL, Oracle, or another XML aware data source. If you are not,create a transaction (assuming your data source supports transactions), walk through each row of your data source and perform your insert/update, and commit the transaction.
Jim Conigliaro
jconigliaro@ieee.org
|
|
|
|
|
Sir,
I am uploading a file and sending it with the mail
What i want is that i want to show the file as a hyperlink and on click of the link the file should be opened automatically.
It is a web based project(means file can be opened in sone other computer)
so how should the link for download a file as hyperlink should be given
Thanks
Plese Read it
|
|
|
|
|
Hi,
I'm trying to create a new row and add values to the column in the below code.
But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ".
DataSet dset = new DataSet();
SqlCommand dbcommand = new SqlCommand();
dbcommand.CommandText ="select * from DBTable";
dbcommand.Connection = myConnection;
SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand);
dbDA.Fill(dset, "DBTable");
DataTable dbtable = dset.Tables[0];
// dset.Tables.Add(dbtable);
DataRow row;
row = dbtable.NewRow();
row["Name"] = DBfile;
row["Meters"] = IMeter;
dbtable.Rows.Add(row);
dbDA.Update(dset);
any solution? or let me know how to create a new row and assign values to the columns.
|
|
|
|
|
It had happend to me some times ago.
I used mapping table name as "Table" then it was sorted.
when you query then it doesn't understand or pick the table name.
it might help you also.
Naveed Kamboh
|
|
|
|