Click here to Skip to main content
15,886,137 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 1:31
professionalDaveyM696-Sep-10 1:31 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 1:54
professionalDaveyM696-Sep-10 1:54 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Lee Reid6-Sep-10 2:08
Lee Reid6-Sep-10 2:08 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 2:13
professionalDaveyM696-Sep-10 2:13 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Pete O'Hanlon6-Sep-10 3:41
mvePete O'Hanlon6-Sep-10 3:41 
AnswerRe: Need help with co/contravariance and generic lists :s Pin
PIEBALDconsult6-Sep-10 7:32
mvePIEBALDconsult6-Sep-10 7:32 
QuestionHow to deploy an Outlook 2003 add-in application(C# and VS 2008)? Pin
milestanley5-Sep-10 22:57
milestanley5-Sep-10 22:57 
QuestionCould use some help please. Pin
pestman5-Sep-10 22:01
pestman5-Sep-10 22:01 
Ok ill start by saying I am new to c# what i am trying to do is basicly access a ultralite db it has a table named Names(name,chan,freq,mpchan) I want to populate a combox with name field than have 3 text fields populate with the appropriate data for the name selection. Here is what i got so far
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using iAnywhere.Data.UltraLite;
using System.Collections;

namespace ChannMap
{
    public partial class Form1 : Form
    {
        private string strChan;
        private string strFreq;
        private string strName;
        private string strMapChan;
        private string strTemp;
        private string [] strArraylist=new string [1000];
        static int i = 0; //index for strArraylist
        private ULConnection ConnUL = new ULConnection();
        private ULDataAdapter myDataAdapter = new ULDataAdapter();
        private void Form1_Load(object sender, System.EventArgs e)
        {
            fnGetConnectedToDatabase();
        }
        public Form1()
        {
            InitializeComponent();
            
        }
        private void fnGetConnectedToDatabase()
        {
            try
            {
                String dbf = "\\Program Files\\ChannMap\\ChannMap.udb";

                if (System.IO.File.Exists(dbf))
                {
                    ConnUL.ConnectionString = "dbf=" + dbf + ";cache_size=1M";
                    if (ConnUL.State != ConnectionState.Open)
                    {
                        ConnUL.Open();
                    }
                    ConnUL.DatabaseID = 1000;
                }
                else
                {
                    MessageBox.Show("Database is not available", "Error");
                    Application.Exit();
                }
            }
            catch (System.Exception t)
            {
                MessageBox.Show(t.Message, "Connection failed");
                return;
            }
            string sqlStr = "SELECT * FROM Names;";
            			myDataAdapter = new ULDataAdapter(sqlStr,ConnUL);

			//Instantiate a DataSet
			DataSet myDataset = new DataSet();
			
			// Populate the data table "Names"
			myDataset.Clear();
			myDataAdapter.Fill(myDataset,"Names");		
			
			foreach (DataRow myRow in myDataset.Tables["Names"].Rows)
			{
				strChan =(string) myRow["chan"];
                strFreq = (string)myRow["freq"];
				strMapChan=(string) myRow["mpchan"];
                strName=(string) myRow["name"];

                strTemp=strChan+"*"+strFreq+"*"+strMapChan+"*"+strName;
				//put strTemp into string strArraylist with int i(index for strArraylist)
				strArraylist[i++]=strTemp;
				//display in the ComboBox only strStudentID
				comboChanName.Items.Add(strName);
			}
			// Close the connection to the database.
			ConnUL.Close();

        }
        private void comboChanName_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string delimstr = "*";
            char [] delimeter = delimstr.ToCharArray();
            string [] splitstr = null;

            splitstr = strArraylist[this.comboChanName.SelectedIndex].Split(delimstr, 4);
            //Now assign the data from splitstr to TextBoxes
            textBox1.Text = splitstr[0];
            textBox2.Text = splitstr[1];
           textBox3.Text = splitstr[2];
           textBox4.Text = splitstr[3];

        }///////////////////////////////////////////////


    }
}

splitstr = strArraylist[this.comboChanName.SelectedIndex].Split(delimstr, 4);
this piece when i try to deploy gives the error cannot convert char[] to char and cannot convert int to char. This a mobile app to. Am I going about this the hard way is there a better way or can this code be fixed?

Thank you for any help
Aaron
AnswerRe: Could use some help please. Pin
Kubajzz5-Sep-10 22:21
Kubajzz5-Sep-10 22:21 
GeneralRe: Could use some help please. Pin
pestman6-Sep-10 6:27
pestman6-Sep-10 6:27 
GeneralRe: Could use some help please. Pin
Kubajzz6-Sep-10 9:51
Kubajzz6-Sep-10 9:51 
Question"Cannot connect back" - Visual Studio 2008 Remote Debugger for C# apps Pin
Maxwell Chen5-Sep-10 20:19
Maxwell Chen5-Sep-10 20:19 
QuestionQuestion about RegEx Class Pin
Mazdak5-Sep-10 16:24
Mazdak5-Sep-10 16:24 
Answercross-post Pin
Luc Pattyn5-Sep-10 16:54
sitebuilderLuc Pattyn5-Sep-10 16:54 
AnswerRe: Question about RegEx Class [modified] Pin
PIEBALDconsult5-Sep-10 17:34
mvePIEBALDconsult5-Sep-10 17:34 
QuestionNot able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 2:39
Aseem Sharma5-Sep-10 2:39 
AnswerRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Not Active5-Sep-10 3:04
mentorNot Active5-Sep-10 3:04 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 4:19
Aseem Sharma5-Sep-10 4:19 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Not Active5-Sep-10 5:12
mentorNot Active5-Sep-10 5:12 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 5:35
Aseem Sharma5-Sep-10 5:35 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Not Active5-Sep-10 5:56
mentorNot Active5-Sep-10 5:56 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 6:20
Aseem Sharma5-Sep-10 6:20 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Dave Kreskowiak5-Sep-10 11:09
mveDave Kreskowiak5-Sep-10 11:09 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 19:59
Aseem Sharma5-Sep-10 19:59 
AnswerRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Luc Pattyn5-Sep-10 6:26
sitebuilderLuc Pattyn5-Sep-10 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.