|
hi let me rephrase my question...
a combobox has 2 values..
name
email
when i run this project .. my problem is i don want to see
blank (first line)
name
email
i want to view it as
name
email
|
|
|
|
|
Hi!
Just set the SelectedIndex or SelectedItem property of the combobox to the desired value.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I get the following exception when I try to update my database It says:"Update requires a valid InsertCommand when passed DataRow collection with new rows."
and I dont know how to add the appropriated insert command.
Please help, thanks.
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Data.OleDb;<br />
using System.Data;<br />
<br />
namespace WindowsFormsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=E:\\hp\\Source\\Val-Asr-LastPart\\db1.mdb");<br />
con.Open();<br />
string sqlstr = "SELECT * FROM kham";<br />
OleDbCommand com=new OleDbCommand(sqlstr,con);<br />
OleDbDataAdapter da =new OleDbDataAdapter(com);<br />
DataSet ds = new DataSet();<br />
da.Fill(ds, "kham");<br />
DataRowCollection drc = ds.Tables["kham"].Rows;<br />
textBox1.Text = (string)drc[0][1];<br />
<br />
<br />
string str1 = (string)drc[0][1];<br />
string st="";<br />
string stt="";<br />
char[] ch1 = str1.ToCharArray();<br />
int k=0;<br />
int i=0;<br />
<br />
<br />
sqlstr="SELECT * FROM parsed";<br />
com.CommandText=sqlstr;<br />
da=null;<br />
da=new OleDbDataAdapter(com);<br />
ds=null;<br />
ds=new DataSet();<br />
da.Fill(ds,"parsed");<br />
for (; i < ch1.Length; i++)<br />
{<br />
if ((ch1[i] == '1' || ch1[i] == '2' || ch1[i] == '3' || ch1[i] == '4' || ch1[i] == '5' || ch1[i] == '6' || ch1[i] == '7' || ch1[i] == '8' || ch1[i] == '9' || ch1[i] == '0') && (ch1[i + 1] == '?'))<br />
{<br />
for(i++;i<ch1.length;i++)><br />
if ((ch1[i]!='(')||(ch1[i+1]!='['))<br />
st += ch1[i];<br />
else<br />
{<br />
for (i += 6; i < ch1.Length; i++)<br />
if ((ch1[i] == '1' || ch1[i] == '2' || ch1[i] == '3' || ch1[i] == '4' || ch1[i] == '5' || ch1[i] == '6' || ch1[i] == '7' || ch1[i] == '8' || ch1[i] == '9' || ch1[i] == '0') && (ch1[i + 1] == '?'))<br />
{<br />
string[] sst = { ""+(k++), st, stt };<br />
ds.Tables["parsed"].Rows.Add(sst);<br />
stt = "";<br />
i--;<br />
break;<br />
}<br />
else<br />
stt += ch1[i];<br />
break;<br />
}<br />
}<br />
<br />
}<br />
da.Update(ds,"parsed");
}<br />
}<br />
}<br />
</ch1.length;i++)>
modified on Saturday, January 05, 2008 9:31:30 AM
|
|
|
|
|
This may be a hard question but i really wondered and needed. How can we make some certain wireless connections disappear from (winxp) existing wireless connections list. (for example i want to omit usr9600 connection). is this possible
|
|
|
|
|
i have two combobox one of them is dependent to the other, how can i let the content of the first one change whenever i choose an opition from the second combobox.
|
|
|
|
|
azza104 wrote: how can i let the content of the first one change whenever i choose an opition from the second combobox.
Write a handler for the first combobox's SelectionChangeCommited [^] event. In this handler, reset the contents of the second combobox.
/ravi
|
|
|
|
|
thanx for your reply, i used the SelectedChangeCommitted but i don't have an efficient result.
this is my code:
at the designer.cs file:
this.combo_origion.SelectionChangeCommitted += new System.EventHandler(this.c);
and at the code file:
private void c(object sender, EventArgs e)
{
ComboBox com = (ComboBox)sender;
string selectedItem = combo_origion.SelectedText;
fill_locations(selectedItem);
}
/***************** at the following method the second combobox should change its content whenever the first one change the selected item ****/
private void fill_locations(string s) {
string st = combo_origion.Text;
SqlDataAdapter dtp = new SqlDataAdapter("get_locations", conn);
dtp.SelectCommand.CommandType = CommandType.StoredProcedure;
dtp.SelectCommand.Parameters.Add("@type_text", SqlDbType.NVarChar).Value = s;
DataSet chds = new DataSet();
dtp.Fill(chds);
combo_locations.DataSource = chds.Tables[0].DefaultView;
combo_locations.DisplayMember = "location";
combo_locations.ValueMember = "location_id";
//combo_locations.DataBind();
}
|
|
|
|
|
i the previous method is true i fixed my database and its run now , but the changes happens after selecting the item two times...so do u know the problem here?
|
|
|
|
|
Can anyone recommend a good book for self learning C#?
I'm looking for something that is reasonably up to date and has plenty of programming exercises to stretch the brain. I like the Deitel books because they have good exercises, but they cost too much and weigh a ton.
A book that includes multimedia programming would be good but not essential.
Thanks
James
Melbourne
|
|
|
|
|
Personally I love this[^] book ... it doesn't really have any exercises but its a great foundation for learning C#.
It's currently in it's 4th edition having been updated each time for the various releases of C# and .Net and covers everything from your primative types to Linq
|
|
|
|
|
I'd second that recommendation. While it doesn't cover absolutely everything, it does give you enough to know how to accomplish most tasks, and it points you in the right direction when you need to go beyond "the basics".
|
|
|
|
|
Any of the O'Reilly books are good. They don't usually have programming excercises like Deitel but they are excellent resources.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Deitel it is then I think.
Thanks all for your responses.
James
|
|
|
|
|
For newone in C# its good to study
Visual C# for dummies
also you can go for SAMS book i.e Teach yourself Visual C# in 21 days but as you said you want exercises then still i ll prefer Dietel book of csharp! You can have its electronic or soft version...
Wrox press's book "Beginning Visual C# 2005" is good too.
|
|
|
|
|
Member 884411 wrote: Can anyone recommend a good book for self learning C#?
I've found that the Microsoft Press Step-by-Step series are really quite good.
|
|
|
|
|
|
|
See Console.Beep() [^]. Your app doesn't have to be a console app in order to use this method.
/ravi
|
|
|
|
|
hi
in my application i am sending message to a client using socket now if the clients network cable is unplugged ...still the messages which i am sending are going without any error .....now this is creating a problem so if any one knows how to know the clients network cable is plugged in or not please do let me know ......as i am strucked at this point
regards
sindhu tiwari
Always Innovative
modified on Saturday, January 05, 2008 3:12:21 AM
|
|
|
|
|
Hi!
What kind of protocol are you using? Sockets can be used for all kinds of protocols, some of them containing ways to ensure that a message has been received, while others (like UDP, for example) don't give you this option.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
TCP/IP .......
its me sid
|
|
|
|
|
How about showing some code or being a little more verbose?
It's almost impossible to help you if every single piece of information has to be wormed out of you...
If you're using a TcpClient for example, the call to Connect will throw an exception if the remote partner is not available, you can get a SocketException when writing to a NetworkStream with a disconnected remote partner, and so on. So what exactly are you doing and where do you need the information if the remote part is there?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
i am using this thing to send a ping to the client system..fine so suppose the network cable is unplugged still the server is sending the ping ...now when the system shut downs unexpectedlly due to power then the message is not send a exception is coming ..my doubt is why this expection is not raised when network cable is unplugged
regards
sindhu tiwari
its me sid
|
|
|
|
|
Once again - without any code it's impossible to tell where you're going wrong!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Take a look at the System.Net.NetworkInformation namespace.
It contains a class called NetworkChange which contains two events: NetworkAddressChanged tells you when an IP address has changed, and NetworkAvailabilityChanged tells you when any network's availability changes.
This, incidentally, is the same event Windows uses when it shows you the little notification balloon in the task tray when a cable is unplugged - they hook into the same operating system message.
That namespace contains a number of other extremely interesting and useful classes, so spend some time exploring it. You can do pretty much anything you need to with networks using that namespace.
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|