|
Thank you Nafiseh, I appreciate your help. I will try this and post a message if it works.
sasa
|
|
|
|
|
hello,
Since I got no answer on this rather simple question on the mobile dev forum,
I'll repost my question here.
I want to build a tray application for pocket pc 2003.
Does anyone have a good example to start?
greetings,
and tanks in advance
Niko
|
|
|
|
|
How can i convert the DataGridView.SelectedRows to the either the DataRow[] or DataRowView[]. If you have some alternative solution plz tell me.
Thanks
|
|
|
|
|
how to release lock when another thread requests for the same resource, taking input form user
e.g thread1: eating
(now user inputs 2 means 2nd thread wants to eat"how to solve it")
jazzziiii
|
|
|
|
|
i use following code , but my all of my listbox items show DataRow, and display member didnt show.
note: i bind datasource of listbox on runtime.
private void li_name_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)<br />
{<br />
e.DrawBackground();<br />
<br />
Brush myBrush = Brushes.Black;<br />
long AID=0;<br />
DataRowView D_Author_name=(DataRowView)li_name.Items[counter_item];<br />
string Author_name=D_Author_name["Name"].ToString().Trim();<br />
Authors author=new Authors();<br />
AID=author.find_AuthorID(connection.make(),string_process.editition(Author_name));<br />
counter_item=counter_item+1;<br />
if(AID !=0)<br />
{<br />
myBrush = Brushes.DarkGray;<br />
}<br />
e.Graphics.DrawString(((ListBox)sender).Items[e.Index].ToString(), <br />
e.Font, myBrush,e.Bounds,StringFormat.GenericDefault);<br />
e.DrawFocusRectangle();<br />
<br />
<br />
}
<br />
public class Authors<br />
{<br />
OleDbConnection con;<br />
OleDbCommand cmd;<br />
<br />
public long find_AuthorID(string cnstring,string Author_name)<br />
{<br />
try<br />
{<br />
con=new OleDbConnection(cnstring);<br />
string cmdstr="select id from authors where name='" + Author_name.Trim() + "'" ;<br />
int id=0; <br />
cmd=new OleDbCommand(cmdstr,con);<br />
cmd.CommandType=CommandType.Text;<br />
con.Open();<br />
OleDbDataReader rd;<br />
rd=cmd.ExecuteReader();<br />
if (rd.Read())<br />
{ <br />
<br />
id=(int)rd[0];<br />
con.Close();<br />
<br />
return id;<br />
<br />
}<br />
else<br />
{<br />
con.Close();<br />
return 0;<br />
<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
return -1;<br />
<br />
}<br />
}<br />
}<br />
|
|
|
|
|
nafiseh_salmani wrote: e.Graphics.DrawString(((ListBox)sender).Items[e.Index].ToString(),
This is the problem, you're getting the ToString of the DataRow class. If you want to draw the DisplayMember then you'll need to use reflection to get the value of the property given in DisplayMember, you can then use that as the string.
If DisplayMember will always be a the value from a column of the row then you can use that as the key for the columns. I.e. cast the ListBox.Items[e.Index] to a DataRow and then retrieve the value from the columns.
So if DisplayName is the column name:
ListBox tempListBox = (ListBox)sender;
DataRow dataRow = (DataRow)tempListBox.Items[e.Index];
e.Graphics.DrawString(dataRow.Columns[tempListBox.DisplayMember].Value, ...); I'd suggest optimising the code as well because even you're snippet has a lot of boxing and unboxing going on and if the list contains more than a few items then you're going to take some serious performance penalties.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thanks, i did it before read your reply
but now , i have another problem with these items.
when i want to click on one of them their places change , and their text mixed together !!!!
|
|
|
|
|
I'm not sure based on your code but there'll be something wrong with the layout logic somewhere.
I did have a fantastic example from my "Programming Visual Basic .NET" book by Balena but can't find the code at the moment, take a look at the source code in this[^] article in the meantime.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hello fellows.
I am developing a PDA application is c#.I have two problems in it
1.I want to set any page as startup.so that when the application runs that page is opened.but i dont know how can i do that.
2.I want to transfer some files from my pc to pda and vice versa.how can i do that?please help me out.
Ahsan Ullah
|
|
|
|
|
how to select all table names in MSSQL 2005. i tried the select * from catquery, but it doesn´t work.
cellardoor
|
|
|
|
|
use databse<br />
select * from INFORMATION_SCHEMA.TABLES
|
|
|
|
|
|
|
I would like a short example on how to populate a comboBox with the result of an SQLcommand.
Thanks!
|
|
|
|
|
it is vb.net example, but same do in C#
http://rustemsoft.com/vbbegin.htm#1
|
|
|
|
|
use:
private void Form2_Load(object sender, System.EventArgs e)<br />
{<br />
Authors authors = new Authors();<br />
DataTable Name;<br />
Name=authors.find_AuthorsName_all(connection.make());<br />
<br />
<br />
cmb_AuthorName.DataSource=Name;<br />
cmb_AuthorName.DisplayMember="name";<br />
cmb_AuthorName.ValueMember="id";<br />
}
Author class:
<br />
public class Authors<br />
{<br />
OleDbConnection con;<br />
OleDbCommand cmd;<br />
<br />
public DataTable find_AuthorsName_all(string cnstring)<br />
{<br />
con=new OleDbConnection(cnstring);<br />
<br />
<br />
try<br />
{<br />
<br />
con.Open();<br />
string cmdstr="select id,name from Authors ";<br />
cmd=new OleDbCommand(cmdstr,con);<br />
cmd.CommandType=CommandType.Text;<br />
OleDbDataAdapter adp=new OleDbDataAdapter(cmd);<br />
DataTable dt =new DataTable("Authors");<br />
adp.Fill(dt);<br />
con.Close();<br />
return dt;<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
con.Close();<br />
return null;<br />
}<br />
<br />
<br />
}<br />
}<br />
|
|
|
|
|
Open/Save word documen in the server
i need to open the word document in the server and display it
to the user, and save changes if any to the server back
i am able to open and display it in explore (.doc file is in url)
but save back to server ?? so for this i need some control with in with
i can open and save ,
if any of u had gown through the same problem.
pls respond
Understanding comes from failures
SUCESSES comes form understanding failures
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
i made a form of student registration. here i create two radio buttons against gender (Male,Female), and create database connectivity of these two buttons, now when i click on radio button for male or female it gives me error that "number of query values and destination fields are not the same". how the entries of radio button goes in databse plz tell me. i'm so worried following is my code which use for database connectivity of radio buttons.
------------------------------------------------------------------------
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\C#Projects\\practice1\\db1.mdb;Persist Security Info=False");//("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\C#Projects\\practice1\\SMSDB.mdb;Persist Security Info=False");
con.Open();
string idata = "insert into db1 values('"+txtID.Text+"','"+rbmale.Text+"','"+rbfemale.Text+"')";
OleDbTransaction tx = con.BeginTransaction();
tx.Commit();
OleDbCommand cmd = new OleDbCommand(idata,con);
cmd.ExecuteNonQuery();
con.Close();
-------------------------------------------------------------------------
m.reehanmunir
|
|
|
|
|
r_e_h_a_n wrote: string idata = "insert into db1 values('"+txtID.Text+"','"+rbmale.Text+"','"+rbfemale.Text+"')";
Well, your approach to database development will never scale to real world apps, but I guess it's fine for now. You're passing the text of both radio buttons to the database. It does not surprise me that you don't have three fields to save against. You probably want something like this:
string idata = "insert into db1 values('"+txtID.Text+"','" + rbmale.Checked ? "M" " "F"+"')";
This stores M or F, depending on if rbMale is checked or not.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear Reehan Bhai,
Please change your Insert query as following:
String idata="Insert into db1 values("+txtID.Text+","+(rbmale.Checked ? rbmale.Text:tbfemale.Text+")";
I think above query must solve your problem.
Regards,
Wasif Ehsan
|
|
|
|
|
I have 2 Applications : Client and Server.
Server application contains class DataForClient.
Client uses this class (in SingleTon mode) using .NET Remoting.
Problem is:
1) How Server application can control
DataForClient class initialization process ?
2) How to create DataForClient object on Server
manually then Client want to use it ?
|
|
|
|
|
I am using ClickOnce in Visual Studio 2005 Express. Everything is working fine. I am publishing my application to a web link:
http://andromeda/RuntimeConfig/RuntimeConfigTest.application
The issue I have is that when I try to create a desktop shortcut to the address, I get an error that states the shortcut is not valid. I guess it's expecting an absolute file path, or UNC path. It works with an IE favorite link, but when I click the link IE opens then closes immediately after my WinForm app displays. Is there any way to create a http:// shortcut link while preventing the browser from opening?
Thanks
Raffi
|
|
|
|
|
Can't you just copy the shortcut from your start menu?
Although I have done what you are doing without any problems, perhaps you have a file association problem.
Don't forget to include all the params in the shortcut link as well.
HTH
g00fy
|
|
|
|
|
If you are referring to the shortcut created by ClickOnce when the application is first installed on the client's machine, I can't seem to access to manipulate the shortcut Properties. I dumped the shortcut to a text editor and this is what's inside...
http://andromeda/RuntimeConfig/RuntimeConfigTest.application?#RuntimeConfigTest.application, Culture=neutral, PublicKeyToken=723942b244e09dfc, processorArchitecture=msil[^]
I tried adding a query parameter to the embedded link, but the shorcut doesn't work after I change it.
If the application is published using a UNC path, is it possible to pass name/value arguments to the app in the UNC path? I tried doing this as well with a standard shortcut but it didn't work; the shortcut refused to let me apply the changes to it. Here is what I tried to do:
\\andromeda\PUBLISH\RuntimeConfigTest.application environment=qa
and this didn't works
\\andromeda\PUBLISH\RuntimeConfigTest.application?environment=qa
thanks
|
|
|
|