|
plz help me convert this code in vb.net..please help
public CascadingDropDownNameValue[] GetCountry()
{
CascadingDropDownNameValue[] country = new CascadingDropDownNameValue[252];
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(Server.MapPath("CountriesAndProvinces.xml"));
XmlNodeList xmlNl = xmlDoc.SelectNodes("CountriesAndProvinces/Countries/Country");
int i = 0;
foreach(XmlNode node in xmlNl)
{
country[i] = new CascadingDropDownNameValue(node.LastChild.InnerText, node.FirstChild.InnerText);
i++;
}
return country;
}
|
|
|
|
|
We cant help you such a way .. And you have posted it in C# not in C#toVb.Net forum.
All you need to do is google a converter . . a c# to vb.net converter. You can find many. They are free easy and ready to work. So first try yourself and then come here . . .
This is what a real computer freak does. ....
|
|
|
|
|
What sort of help are you seeking? If you are looking for someone to convert the code for you then you have rarest of rare chance here.
जय हिंद
|
|
|
|
|
I am new to threading and was wondering how to tell if you have "memory leaks"?
|
|
|
|
|
You will need to analyse your code. Check if the unreferenced objects are disposed or not.
.Net Memory profiler[^]
जय हिंद
modified on Saturday, March 21, 2009 9:16 AM
|
|
|
|
|
I have made a User Control in C#. It has two buttons, Submit and Cancel. The Submit button event is handled in the Control's code itself. I want to handle that Cancel buttons event so that it closes the form on which it is placed. And I want to make that Submit button the AcceptButton and Cancel as the CancelButton. Please tell me in what way I can achieve this.
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
On CancelButton's clientclick event write a client side (javascript) function to close the window.
e.g;
window.opener=null;window.close();
Hope this helps
|
|
|
|
|
Its a window application for which I was talking about... I think this solution will work for the Web Applications. I dont have that knowledge about web applications. Anyway thanks for trying.
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
Since the usercontrol does not have a accept button property, you will need to expose the submit button and then set the AcceptButton property. Same will work with the cancel button as well.
जय हिंद
|
|
|
|
|
Thanks for the Answer. Can you tell me how to expose the button ? Do you mean that I should add the button on the control at runtime ?
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
If you need to be able to set Accept and Cancel you can't do it with the designer.
In the user control create readonly properties for Accept and Cancel buttons
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IButtonControl AcceptButton
{
get { return button1; }
}
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IButtonControl CancelButton
{
get { return button2; }
} then in the host form you can set in code
AcceptButton = userControl11.AcceptButton;
CancelButton = userControl11.CancelButton;
If you want it through the designer then you can only have one button. Just make the user control also derive from IButtonControl and implement it to use the button in question.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Wow...didn't knew this thing. If had the same issue, I would have exposed the button to the form. This would have made the purpose of having a user control go in vain. It's one thing I learnt today. Thanks.
जय हिंद
|
|
|
|
|
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks a lot for this one...I will surely try this one. And what about the event handler ? Can you help me ?
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
There's a few ways this can be done. The easiest is just to subscribe in the user control and raise a new event each time.
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class UserControl1 : UserControl
{
public event EventHandler Button1Clicked;
public event EventHandler Button2Clicked;
public UserControl1()
{
InitializeComponent();
button1.Click += new EventHandler(button1_Click);
button2.Click += new EventHandler(button2_Click);
}
protected virtual void button1_Click(object sender, EventArgs e)
{
EventHandler eh = Button1Clicked;
if (eh != null)
eh(this, e);
}
protected virtual void button2_Click(object sender, EventArgs e)
{
EventHandler eh = Button2Clicked;
if (eh != null)
eh(this, e);
}
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IButtonControl AcceptButton
{
get { return button1; }
}
[Browsable(false),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IButtonControl CancelButton
{ get { return button2; }
}
}
} You now have userControl11.Button1Clicked and userControl11.Button2Clicked events available in your host form like any other control's events.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: You now have userControl11.Button1Clicked and userControl11.Button2Clicked events available in your host form like any other control's events.
Thank you very very much
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
Hi, Does anyone know how to insert a method summary Snippet or any shortcut key,
private void MyFunction()<br />
{<br />
}<br />
or
Is there a way to create such a snippet?
Kelvin
|
|
|
|
|
|
I'm using VS2008 to develop C# applications.
Where can i find all the shortcut key of VS2008?
Perhaps, the experience programmers can share with me the useful shortcut keys or macro which can improve coding productivity.
Kelvin
|
|
|
|
|
8kelvin wrote: I'm using VS2008 to develop C# applications.
Where can i find all the shortcut key of VS2008?
Here[^] is an good article from Code project.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Very helpful tips, thanks Abhijit Jana.
Kelvin
modified on Thursday, March 19, 2009 1:17 AM
|
|
|
|
|
|
I got the 101 C# Samples from the redirect link too.
Thanks, Pankajkumar Nikam.
Kelvin
|
|
|
|
|
8kelvin wrote: Thanks, Pankajkumar Nikam.Thumbs Up
You are welcome 8kelvin
Always Keep Smiling.
Yours Pankaj Nikam
|
|
|
|
|
Hi all
I have 2 tables in the same data set like this:
string sqlCus="select * from Customers";
string sqlOrder="select * from Orders";
SqlDataAdapter daCus=new SqlDataAdapter(sqlCus,conn);
SqlDataAdapter daOrder=new SqlDataAdapter(sqlOrder,conn);
DataSet ds=new DataSet();
daCus.Fill(ds,"Customers");
daOrder.Fill(ds,"Orders");
now I want to get the OrderID column in Orders table and ContactName (CustomerName) in the Customers table according to the CustomerID column in the Orders table then show both column in a DataGridView control, how to do that?
note: not use stored procedure and Linq
|
|
|
|