I have 4 buttons on my smart device form and I am trying to put elements of a string array in to my buttons as button text.

string[] str1 = new string[8] { "aaa", "sss", "ddd", "dff", "fddd", "ffggg", "bbbb", "gggd" ,"shehs"};

there is up and down buttons below the for main button on form load i want to show first 4 array elements as button text ("aaa", "sss", "ddd", "dff" ) and when i click the down button it should show me the next 4 elements of the string array ("fddd", "ffggg", "bbbb", "gggd") and then the last array element("shehs") and then back to the first 4 array elements. I would really apreciate it if some one would lend me a hand.

I am using C# for this application

You could extract all the needed strings from your main string array and put them in a new string array. This would simplify things I guess.
I write it out here to explain it to you, but you should use some sort of loop for this.

newStr[0] = str1[0] + str1[1] + str1[2] + str1[3];
newStr[1] = str1[4] + str1[5] + str1[6] + str1[7];
newStr[2] = str1[8];

You could extract all the needed strings from your main string array and put them in a new string array. This would simplify things I guess.
I write it out here to explain it to you, but you should use some sort of loop for this.

newStr[0] = str1[0] + str1[1] + str1[2] + str1[3];
newStr[1] = str1[4] + str1[5] + str1[6] + str1[7];
newStr[2] = str1[8];

Thanks for your help ddanbe I will try an use this on my app.

How can I connect to a SQL server(not SQL Compact Edition)Database from my Smart device. I am a bit stuck on this because the connection string does not seem to work it gives me a (Null reference error) I checked the SQLcommand text and that was working properly as well

This is the code I used

This is the connection string that was shown to me when I added the database connection and I tested the connection and it worked fine but still the data set is Null

string sConnection = "Data Source=SOFTSERVER;Initial Catalog=Resmanagement;User ID=sa;Password=thadiya";


This is the connection string i used earlier with the IP address and the Port on the server which I am connected to with a network.

string sConnection = "Data Source=192.168.1.1,1433;Initial Catalog=Resmanagement;User ID=sa;Password=thadiya;";


SqlConnection sqlceconn = new SqlConnection(sConnection);


SqlCommand command = sqlceconn.CreateCommand();

command.CommandText = "Select CashierName from REF_Cashiers";

SqlDataAdapter adapter = new SqlDataAdapter(command);

DataSet ds = new DataSet();

even though there is one record in the table it still shows this error.
is there any thing to do in addition when using smart devices apps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.