1,469 Posted Topics

Member Avatar for DioRani

try this piece of code: [CODE] static void Main(string[] args) { string str1 = "Users: What is Apple?"; string[] arrayS = str1.Split(' '); string str2 = arrayS[arrayS.Length - 1]; if (str2.Contains("?") || str2.Contains("!") || str2.Contains(".") || str2.Contains(",")) str2 = str2.Remove(str2.Length - 1, 1); Console.WriteLine("{0} is a frut.", str2); Console.ReadLine(); }[/CODE]

Member Avatar for Mitja Bonca
0
168
Member Avatar for micahgeorge

To set the dateTime to 00:00:00 you can only do: [CODE]DateTime startTine=DateTime.Today;[/CODE] Where exactly do you use this code - in what kind of calculation? If you are doing with counters, its better to you TimeSpan as Momerath said a post above. Give me some more code, maybe we can …

Member Avatar for Momerath
0
8K
Member Avatar for denmarkstan

Try to change your second static method, that will fill the result in the dataTable from sqlDataAdapter: [CODE] private static DataTable LookupUser2(string RegNumber) { // where i am looking into dbs in search of where RegNumber exist. // ERROR COMES FROM HERE string connStr = ConfigurationManager.ConnectionStrings["SchooldataConnectionString1"].ConnectionString; const string query = …

Member Avatar for Mitja Bonca
0
288
Member Avatar for AngelicOne

An example in console application how to join data tables: One question: Do you have in both tables the same number of Ids? If now, this code can give you an error. [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; namespace Okt17JoinTables { class Program { static …

Member Avatar for AngelicOne
0
100
Member Avatar for NH1

You have to bind to a different variable in the foreach loop, like: foreach(DataRow row in dt.Rows) { Out = row[1].ToString(); In = row[0].ToString(); }

Member Avatar for Mitja Bonca
0
119
Member Avatar for christos312

Check this out, and let me know if its helps: [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Okt17GetSet { class Program { List<StudentInfo> studentList = new List<StudentInfo>(); static void Main(string[] args) { Program pro = new Program(); pro.GettingStudents(); } private void GettingStudents() { bool bChecking = false; …

Member Avatar for christos312
0
208
Member Avatar for anthonyjpv

What you need is a seperate method (maybe even in a new class) for checking the user name and password. btw, where do you store usernames and their passwords? Do you use a database, or a file on hdd? In any case, you need a new boolean method where you …

Member Avatar for sumran ali
0
203
Member Avatar for AngelicOne

Try to change the AND operators with OR: [CODE] If (textBox1.Text.Length < 5 || textBox2.Text.Length < 5 || textBox3.Text.Length < 5) return false; else return true; [/CODE] It should work now.

Member Avatar for Mitja Bonca
0
39
Member Avatar for shibin09

Why would you need a database at all for only chat application? As somekind of a log? Instead of that, you can simply use file (write to file). Anyway, if you have decided to use db, it can only be on server side. But I am not really sure why …

Member Avatar for Mitja Bonca
0
151
Member Avatar for RickSMO

The repaired code: (and I added the round function, to 2 decimal places): [CODE] class Program { static void Main(string[] args) { const int SQ_FT_PER_SQ_YARD = 9; const int INCHES_PER_FOOT = 12; const string BEST_CARPET = "Berber"; const string ECONOMY_CARPET = "Pile"; int roomLengthFeet = 12, roomLengthInches = 2, roomWidthFeet …

Member Avatar for RickSMO
0
136
Member Avatar for jay_el_em

Hi, and welcome to programming... If you are creating WinForms App or some other, 1st you create GUI, then you start creating the code, using the Controls (and their methods) putted onto the GUI. This is for the beginnng. When you will become a bit more advanced, you can create …

Member Avatar for Mitja Bonca
0
108
Member Avatar for shibin09

Here is the ansswer: [URL="http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/4b91198e-239a-4a9b-8f57-a183e2552db7"]http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/4b91198e-239a-4a9b-8f57-a183e2552db7[/URL]

Member Avatar for Mitja Bonca
0
101
Member Avatar for Mitja Bonca

Hello, I am doing a C# win. application, and using crystal report for printing bills on a custom paper size The width of the paper is unknown (the program has to get the paper size - if this is possible), the lenth of the paper is infinitive (its a roll …

Member Avatar for Mitja Bonca
0
407
Member Avatar for Mitja Bonca

I would like to do an application which would be used for calling to all kind of telephones (stationary, mobile) from a pc, using internet. Anyone has any advice where to start and what to use? I read some stuff that I would need to use TAPI app. development. Application …

Member Avatar for cottom
0
294
Member Avatar for normmy

[CODE]string[] sections = line.Split(new char[] {"><"}, StringSplitOptions.RemoveEmptyEntries);[/CODE]

Member Avatar for Geekitygeek
0
258
Member Avatar for Mitja Bonca

I would like to create a simple program, like a game, but so far without any graphical interface. Only a code, supported with some numbers, so that the user will know whats going on in the background. I was thinking of creating a racing game (like formula 1 or sometihng …

Member Avatar for papanyquiL
0
110
Member Avatar for aragmus
Member Avatar for srikanth2321

Still unclear... Where exactly do you have all those values now? Because what shows ur 1st post it is not possible (or pointless) to have all those values in a textBox. Please clarify it a bit more, from where to where and what exactly would you like to transfer?

Member Avatar for finito
0
110
Member Avatar for Mitja Bonca

I am doing a crystal report with printing. I have encountered on this problem: [CODE] try { PrintDialog print = new PrintDialog(); print.ShowDialog(); crystalReportViewer1.ReportSource = cr1; crystalReportViewer1.PrintReport(); cr1.Refresh(); cr1.PrintToPrinter(1, true, 1, 1); } catch { //MessageBox.Show("Some error occured...", "Opozorilo", MessageBoxButtons.OK, MessageBoxIcon.Error); } [/CODE] I got an error on last line …

Member Avatar for hirenpatel53
0
323
Member Avatar for Mitja Bonca

I would like to know why sql query for month and year is working, and i[B]s not working for day[/B]: [CODE] string myQuery = "SELECT StudentName FROM Students WHERE " + "YEAR(Birth) BETWEEN @yearFrom AND @yearTo AND " + "MONTH(Birth) BETWEEN @monthFrom AND @monthTo AND " + "DAY(Birth) BETWEEN @dayFrom …

Member Avatar for finito
0
120
Member Avatar for Mitja Bonca

The code bellow is a sql querry, made in code. I would like to know how to do such stored procedure: [CODE] string[] NameSeperated = FullName.Split(' '); string querryName = @"SELECT StudentID FROM Students WHERE Name = @name"; if (NameSeperated.Length > 1) querryName += " AND LastName = @lastName"; using …

Member Avatar for pritesh2010
0
164
Member Avatar for Mitja Bonca

I would like to know how to pass object array (object[]) between classes with the code bellow, which now sends string only: [CODE]public delegate void MessageDelegate(Object sender, MessageEventArgs e); public class MessageEventArgs : EventArgs { public string Message; public MessageEventArgs(string msg) { this.Message = msg; } } public interface IController …

Member Avatar for nick.crane
0
107
Member Avatar for Mitja Bonca

I would like to know how to send a sms (text message) from windows application to a mobile phone (with entering the number) - for free. One and the only option I know (and I tried) is to send it using email. But I do not have any provider in …

Member Avatar for Ramy Mahrous
0
86
Member Avatar for Mitja Bonca

I would like to know how to programmatically call a mathod regarding on time. In my example I would like to call a method every hour. Can I use a Timer or is there something else?

Member Avatar for mcriscolo
0
933
Member Avatar for Mitja Bonca

How to put an image (BitMap) into a statusBar? I was trying with: 1. [CODE]statusBar1.Text = Properties.Resources.MyPucture;[/CODE] 2. [CODE]Bitmap myPic = new Bitmap(Properties.Resources.MyPucture); MethodToShowStatusBarImage() { statusBar1.Text = myPic; }[/CODE] but it is not working. Any clues how to salve this issue? And besides, I have found a lot of example …

Member Avatar for Diamonddrake
0
480
Member Avatar for Mitja Bonca

I would like to know how can I transfter a string value (a name or something) from Login class over static class to Form1? This code I have: 1. In program class: [CODE] static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] …

Member Avatar for kvprajapati
0
258
Member Avatar for Mitja Bonca

I am doing an application which has some calculation code. I would like to know if there is possible to remember the number from the previous event handler? Lets say that I put into textbox1 number 10 and into textBox2 number 5. When the even button1_Pressed starts the code has …

Member Avatar for Geekitygeek
0
130
Member Avatar for Mitja Bonca

The code bellow allow to select only item in a listView. That means there is only one tick in the listView - always. But I would like to change the code bellow that will allow to unselect too, that there will be no tick at all. So, no tick in …

Member Avatar for Mitja Bonca
0
166
Member Avatar for Mitja Bonca

I would like to know if there is any other way to create a doc (or txt) file, then this way that I have in my code: [CODE] if (!System.IO.Directory.Exists(System.IO.Path.GetTempPath() + @"TestDirectory")) System.IO.Directory.CreateDirectory(System.IO.Path.GetTempPath() + @"TestDirectory"); string LogDatoteke = System.IO.Path.GetTempPath() + @"TestDirectory\TestFile.doc"; StreamWriter zapis; zapis = File.CreateText(LogDatoteke); zapis.WriteLine("Some text 1"); zapis.WriteLine(""); …

Member Avatar for apegram
0
113
Member Avatar for Mitja Bonca

I would like to do a payment order, this one with crystal report: I have already created something, but I do not have the exact lenght and width, like the original payment order has it. I would like to know how to do get the exact measurments in the report …

Member Avatar for kvprajapati
0
84
Member Avatar for Mitja Bonca

I have a problem of reading a dateTime column from a database. I set a parameter which is a datetime, but it does not read it. I am wondering what could be wrong. This is how I have written a date and time in the database: [url]http://file.si/pthumbs/large/7216/C%23_datetime_Lista.JPG[/url] And this is …

Member Avatar for kvprajapati
0
92
Member Avatar for Mitja Bonca

I have: Table1: Service: - IDService - ServiceName Table2: Order: - IDOrder - IDServiceFK (foreigh key) I have database table called "Service", in which I store service names. Then I have another table called "Order", in which is the foreigh key of Service. Services are shown in the listView control. …

Member Avatar for apegram
0
156
Member Avatar for Mitja Bonca

How can I use a DataTable to save data into it? I have a listView with ticks, and when a tick is checked, I would like to put the data of the row into DataTable. In the row I have a "ProductName" and it`s "Price". I am doing this becuase …

Member Avatar for JuhaW
0
107
Member Avatar for Mitja Bonca

I have dates and times stored in the database - the data type of DateTime (for example: 17.1.2010 16.23.34 - dd.MM.yyyy hh.mm.ss) The parameter which I define it has too look ONLY of date ("dd.MM.yyyy"), because I want to get all the values on a specific date and the sum …

Member Avatar for Mitja Bonca
0
156
Member Avatar for Mitja Bonca

Why when I save a float value into database (the data type is float as well), for example 24,62 in database is writen as 24,6200008392334. I have entered only 2 decimals, but in db there is plenty of them. This is how I have: [CODE]string Together = textBoxAmount.Text; string[] Seperated …

Member Avatar for sknake
0
119
Member Avatar for Mitja Bonca

I have a listView, in 1st column is are article names, in 2nd column are prices of these articles (data type of float). And I have checkBoxes. What I would like to do, is to count the prices in 2nd column of all selected rows. And then the counted value …

Member Avatar for Mitja Bonca
0
3K
Member Avatar for Mitja Bonca

I get into DataSet CostumerNames and Hours (type DateTime) of their registrations. I would like to sort customers my time of registration (time of a day). I show both in listView. This is my code: [CODE] string DanesRezervacije = "SELECT Stranka.ImePriimek, Naročilo.RegisterTime FROM Stranka, Naročilo " + " WHERE Stranka.IDStranke …

Member Avatar for Mitja Bonca
0
121
Member Avatar for Mitja Bonca

I inserted a value of DateTime into database, like "26.12.2009 11:50:00" . Is it possible that the reader will read only the time of a day from this, without date? So far I did only that it reads everything, date and time: [CODE] string myTime = Convert.ToDateTime(dataGridView1.Rows[IndexVrstica].Cells[0].Value).ToShortTimeString(); DateTime myTime2 = …

Member Avatar for eeyc
0
3K
Member Avatar for Mitja Bonca

How can I simply do a list of hours - a date schedule (from 0 to 24) in a listView, that 1st column would show hours seperated by 30 min, 2nd column then will be filled with the name who will reserved that hour. Something like that: [URL="http://img189.imageshack.us/img189/5023/clistview02.jpg"]PICTURE[/URL].

Member Avatar for Mitja Bonca
0
140
Member Avatar for Mitja Bonca

How can I show a message in the statusBar for 5 seconds? I do some code, on the end I write out a message in statusBar (statusBar.Text = "Notification Message"; ). But I want that is shown for only 5 seconds. Then it dissapears (with statusBar.Text = ""; ) How …

Member Avatar for sknake
0
166
Member Avatar for Mitja Bonca

How to get row and column index when I double click (or some other event) of a cell on a ListView?

Member Avatar for Mitja Bonca
0
220
Member Avatar for Mitja Bonca

I would like to know if is possible to click on every single cell in a listView seperately, like in a datagridview? If I set a full row selection to false I am only able to select the cell in the 1st column. The point or this thread is, that …

Member Avatar for MrSpigot
0
143
Member Avatar for Mitja Bonca

How can I put a progress bar inside this code: (I was trying to use PerformStep method for counting rows in data table, and put this code, but no luck: [URL="How can I put a progress bar inside this code: (I was trying to use PerformStep method for counting rows …

Member Avatar for DdoubleD
0
205
Member Avatar for Mitja Bonca

I would like to do a seperated class with a method which will return CustomerID (this will be a select query from db), based on the Costumer`s name which would come into this method (it will come from a form1`s method - from a textBox). I am not sure how …

Member Avatar for DdoubleD
0
126
Member Avatar for Mitja Bonca

This is how I have a listView:[URL="http://img200.imageshack.us/img200/2497/clistview03.jpg"] PICTURE[/URL] For example, I have clicked on the 6th row (which is colored blue) and with a double click I want to insert "SomeName" into a 2nd column (called 1.rezervacija) beside the 9:30. How to do it so? I need something else, with …

Member Avatar for DdoubleD
0
194
Member Avatar for Mitja Bonca

I would like to ask someone, even someone has told me it is not possible. I have a child form2 which is always visible (there is a listView, which shows some data). Then I have a new child form 3 (which is currently opened) and the form3 now does come …

Member Avatar for Geekitygeek
0
123
Member Avatar for Mitja Bonca

I want to retrieve only one column from dataset or datatable. the dataset has one table and that table has many column. But I want only one column from that table. How can i do it? And that will be still in a dataSet, not in a string.

Member Avatar for towerrounder
0
95
Member Avatar for Mitja Bonca

I would like to know how to do the code for creating a new Folder that the user can rename it instantely after being created. Like in Windows Explorer: [URL="http://www.file.si/files/2zjwzcmya5woaokschgo.jpg"]PICTURE![/URL] When user clicks on "Make New Folder" it creates inside already selected folder and it colors blue (focus is on …

Member Avatar for ddanbe
0
125
Member Avatar for Mitja Bonca

1. My namespace is called "MyNameSpace". So... How to create that Form3 will inherit from Form2, which is already a child of Form1 (Form2 has class: public partial class Form2 : Form) I would like to creat like: class Form3 : Form2 And do not forget, all are windows forms. …

Member Avatar for Geekitygeek
1
254
Member Avatar for Mitja Bonca

I did an application, published and installed it. In my User`s Start Menu there is created a new folder with y shortcut to my application.exe inside. What`s bothering me is the name if this folder. It has a name, that I don`t know how and where to change it. I …

Member Avatar for Mitja Bonca
0
87

The End.