1,469 Posted Topics
Re: How to use a invokeRequired method while you have to invoke a control over threads shows the exmple code with using Delegates bellow: [CODE] Private Delegate Sub MyDelegate(msg As String) Private Sub FillingListBox(value As String) If listBox1.InvokeRequired Then listBox1.Invoke(New MyDelegate(AddressOf FillingListBox), New Object() {value}) Else listBox1.Items.Add(value) End If End Sub … | |
Re: Its impossible to tell you what it should be. I or we (at least for those who dont know this example, and I dount anyone here does), doubt its possible to predict how the inheritance shoud be in yout particular exampe. There is much to learn on this area of … | |
Re: Are yourd dataGriViews data bound? | |
Re: Try to create parameters, rather then passing values in the query it self, using sqlCommand: [CODE] void InsertMethod(string a, int reservation) { using (SqlConnection sqlConn = new SqlConnection("connString")) { string sqlQuery = String.Format(@"INSERT INTO tblOrders VALUES (A = @a, B = @b)"); SqlCommand cmd = new SqlCommand(sqlQuery, sqlConn); cmd.Parameters.Add("@a", SqlDbType.VarChar, … | |
Re: Hi, would you mind showing us the code you got there - would be faster to salve the issue. Thx in advance. | |
Re: You have to use a DataReader class to get a value our of database: [CODE] string cmd = "Select FName From Emp Where EmpID = 20"); OracleCommand oc = new OracleCommand(cmd, oraConnection); //open a connection: oraConnection.Open(); OracleDataReader reader = command.ExecuteReader(); string result = null; if(reader.Read()) result = (string)reader[0]; reader.Close(); oraConnection.Close(); … | |
Re: Ok, I saw this post of yours, and what I want now is a decent explanation of the problem. I will not even look into code of yours, but I need some words what you need to do. Simple. | |
Re: And whai in case if you have numbers: 2,2,2,3,3,3,4 | |
Re: Hello, take a look at this example: [url]http://www.c-sharpcorner.com/UploadFile/mahesh/CreatingDBProgrammaticallyMCB11282005064852AM/CreatingDBProgrammaticallyMCB.aspx[/url] it might come right. | |
Re: What do you think of something like this: [CODE] Class Program Private Shared Sub Main(args As String()) 'example of 4 rows and 2 columns: 'particular bracket: '1st number is value of checkBox (1 is Checked, 0 is not checked) '2nd number is value of text existance (1 text exist, 0 … | |
Re: If I understand you well, you would like to copy content of the dataBase to a textFile. But only the data, or th whole structure, like sql has with "Export" option? | |
Re: Is there any error, when trying to run the 2008 project in VS 2010, or the file simply doesnt start? Usually, an older version, should start in the newer software, so I dont know the cause of the issue. We can check and do one thing. Run the project`s sln … | |
Re: Hi, check for the solution [URL="http://www.bigresource.com/Tracker/Track-ms_sql-CBrwA3u0/"]here[/URL]. | |
Re: Why dont you better create two dataTable for Men and Women, and put both into the dataSet? [CODE] using (SqlConnection sqlConn = new SqlConnection("connString")) { DataSet ds = new DataSet(); SqlDataAdapter da; SqlCommand cmd; DataTable table1 = new DataTable("Men"); DataTable table2=new DataTable("Women"); //fill men`s table: string query1 = @"SELECT * … | |
Re: [CODE] for(int i = 0; i< lstCols.Items.Count; i++) { if((i +1) < lstCols.Count) textBox1.Text += lstCols.Items[i] + ", "; else textBox1.Text += lstCols.Items[i]; } [/CODE] | |
Re: You cannot use an UPDATE statement and then use the Datareader method. This one is for reading data (when doing SELECT statement). | |
Re: Try using TextmWriter object: [CODE] Dim text1 As String = "Some text in the line" Dim text2 As String() = {"a", "b", "c"} Dim path As String = "c:\myFile.txt" 'fill will be create (if not exists) on the c: drive Using fs As New FileStream(path, FileMode.OpenOrCreate) Using tw As TextWriter … | |
Re: You do not pass the parameters to the event. If there is no actual parameters need, you can pass null, like: [CODE] private void but1_Click(object sender, EventArgs e) { load.ClickHandler(null, null); } [/CODE] | |
Re: Heres an exmample: [CODE] private Bitmap transparentImage; public Form1() { InitializeComponent(); transparentImage = new Bitmap(20, 20); Graphics graphics = Graphics.FromImage(transparentImage); graphics.FillRectangle(Brushes.Transparent, 0, 0, 20, 20); graphics.Dispose(); DataGridViewImageColumn imageColumn = new DataGridViewImageColumn(); { imageColumn.Name = "imageColumn"; imageColumn.HeaderText = "Images"; imageColumn.Width = 100; imageColumn.ImageLayout = DataGridViewImageCellLayout.Stretch; imageColumn.CellTemplate = new DataGridViewImageCell(false); imageColumn.DefaultCellStyle.NullValue = … | |
Re: Yee, look this code: [CODE] int intClicks; private void button1_Click(object sender, EventArgs e) { intClicks++; MessageBox.Show("button has been clicked " + intClicks + (intClicks == 1 ? " time." : " times.")); } [/CODE] | |
Re: The problem is in your Select statement. You only select one value (address1), but in the read you want to retreive two values (reader[0] and reader[1]). Solution: or you add two values into select statement, or you remove reader[1] from the while loop. 1.: [CODE] cmd.CommandText = "select address1, address2 … | |
Re: This is the even of some control. This will fire a always file on the form load, becuas the dataGridView always selects the [0,0] based sell - this is upper, left cell. And when it does, the event fires up. What you can do, to prevent executing the code on … | |
Re: Would you like to show me the code? To see what it might be the problem, thx in advance. | |
Re: Hi, check it out here: [url]http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.sendfile.aspx[/url] | |
Re: Hi, you will have to use convert image to a byte array and then back to image. [CODE] 'server/write Dim len As Long = sendBytes.Length Dim Bytelen() As Byte = BitConverter.GetBytes(len) 'send the size of Data first networkStream.Write(Bytelen, 0, Bytelen.Length) 'add write size of Data 2011/3/3 networkStream.Write(sendBytes, 0, sendBytes.Length) '----------------------------------------------------------------------- … | |
Re: I hope this thing is not one method Mitja. This is what is commonly referred to as a [URL="http://en.wikipedia.org/wiki/Code_smell"]code smell[/URL]. Btw, you could tell us where this error uccur. I wont look not the whole code to find you the error in it. | |
Re: You have to pass a value to the 1st subitem of the listView, like that: [CODE] string name = "SomeName"; int id = 2; ListViewItem lvi = new ListViewItem(); lvi.Text = name; lvi-Subitems.Add(id.ToString()); listView1.Items.Add(lvi); [/CODE] If you want to insert in a specific row, you have to create a loop … | |
Re: How to invert? From last to 1st? By which column (items, or subItems)? I need more information. | |
Re: Defenatelly. Expired version in useless now. I am a student too, and I got a lot of software from Microsoft for free as well. Why not using it, if its leagal, and free of charge. | |
Re: If you are updating an existing row in the dataTable, you MUST put a comparison, this is a WHERE clause in the sql query. And you cannot update ID, which is a uniqe key. The Id you have to use to compare which row you have to update. How you … | |
Re: Is should be like this: [CODE] datagridview1.columns[1].HeaderText = "memberID"; [/CODE] columns at index 1 means that the code will chnage the header text in the 2nd column (looking from left to right). | |
Re: Here is the working code: [CODE] Public Sub New() InitializeComponent() Dim ds As New DataSet() Dim table As New DataTable("MyTable") ds.Tables.Add(table) 'my example columns creating and population: table.Columns.Add(New DataColumn("id", GetType(Integer))) table.Columns.Add(New DataColumn("code", GetType(String))) table.Columns.Add(New DataColumn("desc", GetType(String))) table.Rows.Add(1, "ADV", "ADVANCE") table.Rows.Add(2, "ADV", "ADVANCE") table.Rows.Add(3, "BUS", "BUS TICKET") table.Rows.Add(4, "BUS", "BUS TICKET") … | |
Re: Becuase you cannot assign a null value to the Text property of the textBox. You can do a checking if the value is null or not: [CODE] if(c.IDCardNumber != null) txtIDCardNo.Text = c.IDCardNumber.ToString(); else txtIDCardNo.Text = ""; [/CODE] | |
Re: Did you forget to include any reference or application files to the installer? Go to your project, into Solution explorer, right mouse click on the Project name, and select Properties. Go to Publish tab, and click on Application Files and Prerequisites. Check in both if there is anything missed out … | |
Re: For progressBar: Use a System.Windows.Timer class. You only have to get the total time and then set the beginning and the end of the timer. Use Tick event of the timer, to move the progressBar forward. Heres an example: [CODE] private void InitializeMyTimer() { // Set the interval for the … | |
Re: Hi, what is it that you would like to do exactly? | |
Re: Do it this way: [CODE] SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { //save file using textWriter object! } [/CODE] | |
Re: Do it this way: [CODE] Private NewMDIChild As frmReportProblem Private Sub miReportProblem_Click(sender As System.Object, e As System.EventArgs) If NewMDIChild Is Nothing Then NewMDIChild = New frmReportProblem() NewMDIChild.MdiParent = Me NewMDIChild.Show() End If End Sub [/CODE] | |
Re: If you want to get together the data in individual column, you better create as many arrays (or even better generic lists) as you have columns. When you will read line by line, you put 1st value into 1st column, 2nd value into 2nd column, and so on. On the … | |
Re: Check out this code: [CODE] Private Sub textBox1_KeyPress(sender As Object, e As KeyPressEventArgs) 'allows backspace key If e.KeyChar <> ControlChars.Back Then 'allows just number keys e.Handled = Not Char.IsNumber(e.KeyChar) End If End Sub [/CODE] | |
Re: YOu can do it this way: [CODE] //form1: public Form1() { InitializeComponent(); label1.Text = ""; } private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(this); f2.Show(); } public void PassDataFromForm2(decimal value) { label1.Text = value.ToString(); } //form2: Form1 f1; public Form2(Form1 _f1) { InitializeComponent(); this.f1 = _f1; … | |
Re: Sure it is. What you have to so, is to create a new Form, that will look like a messageBox. Put a textBox on it, and a buttons (Ok, Cancel, or what ever). Simple. | |
Re: This is a base example of using connection string, but it works: [CODE] static string connString = @"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"; private YourMethod() { using (SqlConnection sqlConn = new SqlConnection(connString)) { sqlConn.Open(); //do inquieries: string sqlQuery = @"SELECT ... FROM ... WHERE"; } } [/CODE] Use your correc connection string! | |
Re: I hope you are talking aobur DataTables. Simple name them by some uniqe name. If there is no other way, you can use numbers from 1 to 30 (as jockeyvn proposed), or use the name from sql table (table1, table2,table3 - if they are all different). Or use more sql … | |
Re: Ar you sure your 8th column shows this value? Because you stated it as column index no. 7. And one more think: what is it doing this loop: [CODE] foreach (int t in listOfReservationTables) { tables = tables + "," + t.ToString(); } [/CODE] This for sure is not summing … | |
Re: You can use a get set modifier ( a static one, so you will not need to initialize a new form1), and one time you read the text from it, 2nd time you set the text from it: [CODE] //Form1: public static string MyText { get; set; } //this is … | |
Re: Why is your method type of string. You want to get a number, number of comments, so you should work and return an integer. What represents this line of code: [CODE]var comment = db.DMSDataContext.Comments.Where(p => Convert.ToString(p.IdTopic) == IdTopic);[/CODE] I see you aretrying to use Linq query over some objects. Do … | |
Re: This book you are using, uses some strange expressions. It should be written like: Create a dataTable, then do an sql query to fill this table up, and bind it to the dataGridView. In the code this would look like: [CODE] DataTable table; private void GetData() //call this method when … |
The End.