1,469 Posted Topics

Member Avatar for Mr.BunyRabit
Member Avatar for jlivvers

How do you populate the users list on main form? Is it from a DataTable (or dataSet) or some array list? You can use a delegate to pass the data from one form to another, and refreshing the gdv control with calling the method to populate it. YOu can take …

Member Avatar for jlivvers
0
174
Member Avatar for jijo cleetus

This is how you can convert into both cases: [CODE] string ss2 = DateTime.Now.ToString("dd/MM/yyyy hh:mm.ss tt", System.Globalization.CultureInfo.InvariantCulture); string ss3 = DateTime.Now.ToString("MM/dd/yyyy hh:mm.ss tt", System.Globalization.CultureInfo.InvariantCulture); [/CODE]

Member Avatar for jijo cleetus
0
164
Member Avatar for govinda_Alwani

Try using Server - Client appication with tcpListener and tcpClient. This is an example code: [URL="http://www.developerfusion.com/code/3574/a-chat-clientserver-program-for-c/"]Source[/URL] [CODE] //The client: using System.IO; using System.Net; using System; using System.Threading; using N = System.Net; using System.Collections; using System.Windows.Forms; using System.ComponentModel; using System.Runtime.InteropServices; class TalkUser { static Form talk; static N.Sockets.TcpClient TC; [DllImport("kernel32.dll")] private …

Member Avatar for govinda_Alwani
0
177
Member Avatar for bisiii

Take a look into the code I did only for you. Its a code, which allows the user to insert as many numbers and operands as he wants to create a formula. On the end, when he wants to create an out put, he only inserts the enter after number: …

Member Avatar for ddanbe
1
2K
Member Avatar for drake10k

Try this: DELETE FROM allBooks WHERE ([Book Name] = 'book_NameListBox.SelectedItems[0].ToString()')

Member Avatar for drake10k
0
476
Member Avatar for Kath_Fish

Look at this example: [CODE] private void GettingFileContent() { string path = @"C:\1\test3.txt"; //example of two different arrays: //for string array (string[]) you need to define the lenght of it //for the generic list you dont need to //1. int rows = File.ReadAllLines(path).Length; string[] strArray = new string[rows]; //2. List<string> …

Member Avatar for vedro-compota
0
134
Member Avatar for Baby G

Here is an example of how to use a timer. Important to know: Timer tick is the method which is called when the timer come to zero: [CODE] public partial class Form1 : Form { Timer timer1; int counter; public Form1() { InitializeComponent(); label1.Text = "countier: 0"; CreatingTimer(); } private …

Member Avatar for Baby G
-3
264
Member Avatar for SpiderWebs

Update what? You mean dgv? 1st of all, you have to put the gdv creation into a seperate method, which has to be called only ones. Another method will populate the dgv - this method can be called numerous times. And you can use DataSource to populate dgv, no need …

Member Avatar for SpiderWebs
0
161
Member Avatar for moone009

Adapost gave you a great starting point, you only have to build it up a bit: [CODE] private void Method() { string flag = "000-00-0000"; string[] lines = System.IO.File.ReadAllLines(@"C:\1\test6.txt"); foreach (string line in lines) { if (line.Contains(flag)) { MessageBox.Show("The number was found."); break; } } } [/CODE]

Member Avatar for Mitja Bonca
0
5K
Member Avatar for james6754

No this is creating of a new instance of a TextReader object. Check [URL="http://support.microsoft.com/kb/307205"]HERE[/URL] what inheritance is.

Member Avatar for kvprajapati
0
80
Member Avatar for MrCapuchino

You need to create an event on the form for press down. Look at this code: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); this.KeyDown += new KeyEventHandler(Form1_KeyDown); } private void buttonBegin_Click(object sender, EventArgs e) { MessageBox.Show("Button \"Begin\" has been just pressed"); } private void Form1_KeyDown(object …

Member Avatar for MrCapuchino
0
107
Member Avatar for Jazerix

Check it out here: [url]http://msdn.microsoft.com/en-us/library/bb311038.aspx[/url]

Member Avatar for Jazerix
0
156
Member Avatar for Mr.BunyRabit

tblAllEntries.Rows[0].Cells[3].Value = someThing.ToString(); //if the type of the column is not defined - by default is a type of string.

Member Avatar for Mitja Bonca
0
205
Member Avatar for MrCapuchino
Member Avatar for MrCapuchino
0
1K
Member Avatar for walerhola

You need to open streamReade before readint the stream. But instead of opening, you can use the keyword "using", which will do all the needed code instead of you (open, close). Put the StreamReader inthe the brackers of using, like this: [CODE] using(StreamReader sr = new StreamReader("filePath")) { //you code …

Member Avatar for Mitja Bonca
0
5K
Member Avatar for dotancohen

If I understand it is like this: - you open form1 - then you would like to close form1, and open form2? or: - open form1 - open form2 - then close form2, and open form3 This is a bit difference, becuase you have started app. with form1 ( Application.Run(new …

Member Avatar for dotancohen
0
189
Member Avatar for MrCapuchino

This is the best possible solution I will give you now that I know. YOu cannot read only one line from a text file, like read at index. No, you can read some random line, but until that line, the code will read all the lines from 1st to that …

Member Avatar for MrCapuchino
0
2K
Member Avatar for vedro-compota

Hi, 1. to make the cell editable - when you are creating dgv, do: [CODE] dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgv.MultiSelect = false;[/CODE] 2. read the value from the dgv`s cell in a none dgv`s even or method (some button click for example), but remember, cell has to be selected: [CODE] int …

Member Avatar for vedro-compota
0
142
Member Avatar for vedro-compota

Hi mate. You can use a timer. And set it to change the int value on every 5 minutes. If now is 1 set it to 0 and vice versa. You need some help?

Member Avatar for Mitja Bonca
0
137
Member Avatar for Singlem

or... when you are showing form2, hide form1. And when you want to go back to form1 from form2, close (or hide form2) and show form1. As simple as that.

Member Avatar for Mitja Bonca
0
170
Member Avatar for vedro-compota

Which array exactly? Or string[], ArrayList, generic List ? And how many columns has your dgv? Just for your info, for populating dgv, its best practice to use DataSet (or DataTable). Its specially designed for that, becuase you can create columns and rows, its actually a copy of dgv. In …

Member Avatar for vedro-compota
0
199
Member Avatar for vedro-compota

Hi there vedro-compota, Variables exist within the scope of their creation. Make a variable within a class, and that's its scope. Make a variable within a method, and that's its scope. So make it within the program, but outside of any one class. If you make it in the program.cs …

Member Avatar for vedro-compota
0
131
Member Avatar for shajis001

Singlem has given you the code you want. His code starts the timer in the constructor and after 10 seconds the timer Tick event rises and opens form2 - exactly as you wanted. Correct? Or do you want to start the timer? If so put the code of the timer …

Member Avatar for shajis001
-1
847
Member Avatar for johnt68

How will you choose 3,5 or 7 option? You have to do an option to let the user chooses it, and then its simple - get the number user has choosen, and pass it to the method which will create the field of buttons to play: [CODE] using System; using …

Member Avatar for Mitja Bonca
0
95
Member Avatar for vigneshkbv

I did it like: [CODE] public Form1() //constructor { InitializeComponent(); maskedTextBox1.Mask = "aa aa aa aa"; } [/CODE] and it works fine.

Member Avatar for Mitja Bonca
0
94
Member Avatar for NewOrder

A class is a reference type. When an object of the class is created, the variable to which the object is assigned holds only a reference to that memory. When the object reference is assigned to a new variable, the new variable refers to the original object. Changes made through …

Member Avatar for Mitja Bonca
0
122
Member Avatar for JOSheaIV

When ever you are not sure how long is gonna be the array, you never use a "basic" arrays like: string[], int[], bool[], or what ever of these kind. ddanbe has perfectly right, use a generic list, which is in my opinion my far the best type of array. If …

Member Avatar for ddanbe
0
154
Member Avatar for dotancohen

You can use an even FormClosing. Create this event on form creation, and when you will try to exit form, the event formClosing will be rised: [CODE] public Form1() { InitializeComponent(); this.FormClosing+=new FormClosingEventHandler(Form1_FormClosing); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //here you do the code! } [/CODE] btw, for …

Member Avatar for dotancohen
0
98
Member Avatar for cavpollo

you 1st go to the html code of that form and then see carefully that there should be one and only one from tag after body tag. and it should be closed before that body tag like this <body> <form ......> </form> </body>

Member Avatar for cavpollo
0
338
Member Avatar for sandeepamazing

How you are going to open these 3 forms? Will you open 1 and then by clicking something on form1, this has to close and open form2, and so on? 1. You can simply use hide() method for the form you want NOT to show anymore (ps: but it has …

Member Avatar for sandeepamazing
0
97
Member Avatar for destruct0
Member Avatar for james6754

Momerath is right. your "myobject" is only a reference to in instance of a class "Class1" some info [URL="http://msdn.microsoft.com/en-us/library/0b0thckt.aspx"]here[/URL]. Your 2nd example is called inheritance and polymosfism. You create one base class, and derived class(es) from it. Take a look at [URL="http://msdn.microsoft.com/en-us/library/ms173152.aspx"]here[/URL].

Member Avatar for Mitja Bonca
0
80
Member Avatar for MARKAND911

This can help you out: 1. the currency depending on the culture, 2. the currency in your wanted format without any cash mark [CODE] int iValue = 2879068; string sValue1 = String.Format("{0:C}", iValue); string sValue2 = String.Format("{0:#,#.}", iValue); [/CODE] but in case if you want to have some cash mark, …

Member Avatar for MARKAND911
0
130
Member Avatar for MasterGberry

The code above will never work, for many reasons: 1. as ddanbe said, C# needs Main() method to get started (so no Go() method - change the name to Main) 2. About _gameDirectory = FindGameDirectory() ? Where did you innisiate it? Its from no where now. You cannot call in …

Member Avatar for MasterGberry
0
92
Member Avatar for NewOrder

Becuase you are using static methods, you can only use the objects inisde of them, and whats is passed from one to another. This is what you can do: [CODE] class MyClass { public static void Main(string[] args) { Pieces[,] = ChessBoard(); } public static Pieces[,] ChessBoard( ) { Pieces …

Member Avatar for Mitja Bonca
0
99
Member Avatar for aaronmk2
Member Avatar for aaronmk2
0
92
Member Avatar for steven8579

[CODE]//get the selected item: string value = listBox1.SelectedItem.ToString(); //delete it: listBox1.Items.Remove(value); [/CODE] there is another way to get the selecte index (thats an integer) and then remove with using method "RemoveAt", like: [CODE]int index = listBox1.SelectedIndex; listBox1.Items.RemoveAt(index);[/CODE]

Member Avatar for ShahanDev
1
2K
Member Avatar for johnt68

I dont find anything that can be connected with if,else loops in your code, ok it could be, but it would be too complicated. In my opinion fawi`s approach is the right one, I will only modify it a bit, to suit your needs: [CODE] bool flag = false; for …

Member Avatar for Mitja Bonca
0
142
Member Avatar for ImanOcean

This can be some kind of a leading way for you. There is plenty of way how to implement your issue, but one of my best and very efficient is to use while loop. While some value (usually is a boolean) is not the contrary of the pre-set one, the …

Member Avatar for ImanOcean
0
101
Member Avatar for macaela

This is some other solution: [CODE] void ReversingMethod() { string str = "This is a string that needs to be reversed"; Array array = str.Split(' '); Array.Reverse(array); str = null; for (int i = 0; i < array.Length; i++) { str += array.GetValue(i) + " "; } MessageBox.Show("This is a …

Member Avatar for ddanbe
0
171
Member Avatar for sam1

Maybe this might help you out: [CODE] private void Form1_Load(object sender, EventArgs e) { this.Icon = Properties.Resources.MyPic.ico; //MyPic is the icon in your resources! } [/CODE]

Member Avatar for sam1
0
83
Member Avatar for ddanbe

Why dont you put a StreamReader object out of any loops, so it can be accessible to any other sub brackets, loop, etc, like: [CODE] StreamReader myReder; DataTable myTable = new DataTable("MyTable"); DataRow myRow; try { myReader = new StreamReader(fileFullPath); } //code continues.. [/CODE]

Member Avatar for Mitja Bonca
0
572
Member Avatar for vedro-compota

Why do you want to encode a text? A text its alredy encoded, dont you think. You only need to get it from the file into a label.

Member Avatar for vedro-compota
0
154
Member Avatar for NewOrder

btw, why do you use a BinaryRader class, becuase you only read from a text file? Why you dont use StreamReader instead, and you wont even need to convert byte into string, something? An idea. Mitja

Member Avatar for NewOrder
0
950
Member Avatar for james6754

Becuase the private field (price) is created inside a Program class. Even you have called it from a static method, which only can access to the parameters inside of it, you created a new instance of a Program class, and used this instance to connect to the private field. Pritave …

Member Avatar for Mitja Bonca
0
75
Member Avatar for judithSampathwa
Member Avatar for rikiroxs
Member Avatar for rikiroxs
-1
131
Member Avatar for sandeepamazing

On form load call this method: [CODE] private void ResizingForm() { this.Width = 1024; this.Height = 768; } [/CODE]

Member Avatar for Mitja Bonca
0
126
Member Avatar for saurabhtiwari

Does your table get filled up? If not, please try to change your query select string with this one: [CODE]string query = "SELECT Extrausage FROM perclientreport WHERE Bill > '" + 0 + "'";[/CODE] and about updating: [CODE] double ext = Convert.ToDouble(dt.Rows[i]); ext = (ext * 1024) / 100; string …

Member Avatar for ShahanDev
0
114

The End.