1,469 Posted Topics
Re: Is your gridView databound?"( Do you have a new field in datatable like "Status", like you have it in grid view? When you will press a Delete button in gridview, the row will get deleted, but even a field in database must be set to false (or some other value … | |
Re: Hi, Check this link here: http://stackoverflow.com/questions/304337/post-data-to-a-php-page-from-c-sharp-winform?rq=1 Im sure you can find the answer there. | |
Re: Hi, So now you salve the issue about Datetime? -- -- Abour your last issue, not reading data. Does the code go into while loop? (hint: put a break point and go line by line, this way you can check whats really going on). And I would now use a … | |
Re: Did you salve the problem yet? Btw: > and i am in a mess in getting my database connection to my datagridview What should that suppose to mean exaclty? Do you have problems with connection string, or with getting data from database to dgv? | |
Re: Hi, fill DataTable with images from database (or where ever), an then do a loop throuh the rows of dgv, and paste image into each row (to each dgv_image_cell): //create image column DataGridViewImageColumn ic= new DataGridViewImageColumn(); ic.HeaderText = "Images"; ic.Image = null; ic.Name = "imageColumn"; ic.Width = 100; dataGridView1.Columns.Add(ic); //then … | |
Re: Man.. 4 years old thread. Create a new one, if you wanna get some help. thx bye | |
| |
Re: Check out this simple example, here you can see what polymoprhism is all about: class Program { static void Main(string[] args) { Car c = new BMW(); c.Name(); c = new Honda(); c.Name(); c = new Civic(); c.Name(); c = new CBR(); c.Name(); //1. sealed - when using a reference … | |
Re: 1st of all, dont use any parenthesis. next do: "SELECT Member.MemberID, Member.Name , Member.Surname, Rentals.RentalID FROM Member, Rentals WHERE Member.MemberID = Rentals.MemberID AND Member.MemberID = @MemberID" And define @MemberID parameter as you did (paramtreize query) | |
Re: great to hear that. It happens. Just mark the thread as salved - in case if you didnt know that. bye | |
Re: You should use DataRowView class to retreive item and value from comboBox: Dim view As DataRowView = comboBox1.SelectedItem Dim value As Object = view("ColumnNameForValueMember") Dim item As Object = view("ColumnNameForDisplayMember") textBox1.Text = item.ToString() Put this code into comboBox SelectedIndexChanged event. | |
![]() | Re: Hi, Did you add this namespace that you are getting an error? Check here for more info: http://msdn.microsoft.com/en-us/library/system.windows.controls.listview.aspx ![]() |
Re: Momerath is right. I suggest you to do a little search over this forum (or uncle google) and Im sure will will soon fine a good solution. And btw, you are learning, not we. So we would like to see some attiture from you guys, not that only what you … | |
Re: Before that do the select query, to check if this customerName exits of not. If does not exist, do Insert, else show a message box of existance. Will it go? It should be like: protected void Button1_Click1(object sender, EventArgs e) { string sql2 = @"SELECT CustomerName FROM user WHERE CustomerName … | |
Re: Did you set CommandTimeout? Dim command As New SqlCommand(sqlQuery, _Database.Connection) command.CommandTimeout = 10 'some value | |
Re: This is not an easy task to do. You will actually need to have two datatables filled. 1st for all Memebers - display them all in datagrdivirew 2nd for Rents - when clicked on some member, table will get filled every time, and will populate the rows bellow the memeber. … | |
Re: sure, loop through the rows, and check the columns you have a condition, and set ReadOnly to true: For Each row As DataGridViewRow In dgv.Rows If row("ConditionColumnName").Value.ToString() = "your condition" Then row.[ReadOnly] = True 'you can even color the row differently 'like: row.DefaultCellStyle.BackColor = Color.Red Else row.[ReadOnly] = False 'normal … | |
Re: Create a commone event for all the buttons, and then create a class variable (an integer type) and count when click event occures. When counter reashes 3, show a warning message, and reset it back to zero. Will it go? | |
Re: Here is my old calculator code: PS: Add controls (buttons and textboxes on form - check which one are inside the code) public partial class Form1 : Form { decimal num1, total; int operation; bool bNewCalc; bool bNextNum; public Form1() { InitializeComponent(); display.Text = string.Empty; textBox1.Text = "0"; textBox1.TabStop = … | |
Re: What do you mean "Prompt the form name"? And btw instead of returing string, rather return a boolean values - true of false. | |
Re: WHERE Clause is the condition of what the inquiry will be based on. If you do: "SELECT * FROM MyTable" - it will return all data from database table (data are meant all rows, since we use * simbol) If you do: "SELECT * FROM MyTable WHERE Name = "John"; … | |
Re: And you have to be aware of something else, by default radioButtons are meant to have one radio (1st one normally) checked. They are meant that one of them (from a group) is always checked. To avoid this, you have to uncheck the 1st one. | |
Re: string is an alias for System.String. So technically, there is no difference. It's like int vs. System.Int32. As far as guidelines, I think it's generally recommended to use string any time you're referring to an object. e.g. | |
Re: Better to use null as both arguments, then passing some Time parameters to button (2nd example from above is the one you need). But only in case when you will not need and parameters from EventArguments, or sender - but I doubt you will need). Else you can create EventArguments … | |
Re: You can simply remove all what us after parenthesis: Dim str As String = "user1 pass (111.222.333)" str = str.Remove(str.IndexOf("("C)) | |
Re: Why would you use Random class exactly? I dont see a point. To randomly shuffle teams between ? | |
Re: Indeed, you code does not return some value on each possible step of the method. Change it to: public bool GetAdministrators(string userName, string password) { SqlConnection conn = new SqlConnection("Data Source=(local); database=ManagementNAV; Integrated Security=True"); SqlCommand cmd = new SqlCommand("GetAdministrators", conn); cmd.CommandType = CommandType.StoredProcedure; conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); bool bFlag … | |
Re: The simpliest way would be to spit the string by white spaces into string array, and count the words (by Length property): string text = "you long string"; string[] splitted = text.Split(' '); int wordsCount = splitted.Length; Or even better (shorter), by using Linq: int a = text.Split(' ').Select(s => … | |
Re: I would go for a Dictionary<Tkey, Kvalue>, where Tkey will be row index, and Kvalue will be a List<T (and T in a list will be an integer>. Of course, all this will be done when reading a file, row by row: using System.IO; private void buttonGetData(object sender, EventArgs e) … | |
Re: Hmm, some strange code you have there. I have commented all what is strange insid changed code bellow: Public Function ShowData(Query As String) As DataTable Dim dt As New DataTable("myTable") Using con As New SqlConnection(My.Settings.DatabaseICICIConnectionString) Dim da As New SqlDataAdapter(Query, con) da.Fill(dt) da.Displose() End Using Return dt End Function Public … | |
Re: Use DataReader class and Add items to comboBox: Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;data source=C:MyFolder\MyProject\myAccessDatabase.accdb" Dim conn As New OleDbConnection(connString) Dim sql As String = "SELECT ColumnName FROM Clientes" Dim cmd As New OleDbCommand(sql, conn) conn.Open() Dim reader As OleDbDataReader = cmd.ExecuteReader() While reader.Read() comboBox1.Items.Add(reader(0).ToString()) End While reader.Close() conn.Close() cmd.Close() | |
Re: Waht do you mean textarea (data in textarea? what is this? Do you mean TextBox controls? If so you can check: bool bCheckTextBoxes = this.Controls.OfType<TextBox>().Any(a => string.IsNullOrEmpty(a.Text)); if (!bCheckTextBoxes) { MessageBox.Show("Not all textBoxes are fulfiled."); } And which specific column? I am not sure what do you mean. Can you … | |
Re: Is this some column name of some collection object? Maybe you should use indexes instead. Tell us more aobut it. | |
Re: You should consider a bit differently. 1st check only the login data (if username exists in database, and if password matched to this users). Next comes to check the status of the users. Login check: Dim category As String 'class variable so you can then set things based on it … | |
Re: Using some Regex will do: Dim text As String = "<td class=""bld""><span id=""ref_12590587_l"">5,304.48</span>" Dim regularExpressionPattern As String = "\>(.*?)\<" Dim re As New Regex(regularExpressionPattern) Dim dec As Decimal Dim str As String = "" For Each m As Match In re.Matches(text) str = m.Value.Replace(">", "").Replace("<", "") If str.Length > 0 … | |
Re: You have to get an image from database to byte array, and with StreamReader then pass it to pictureBox: Dim ImageByte As Byte() = Nothing Dim MemStream As MemoryStream = Nothing Dim PicBx As New PictureBox() Dim OB As Object Dim WorkingDirectory As String = Application.StartupPath + "\" connString = … | |
Re: Use a break point, and tell us where exactly the error occurs. | |
Re: What does the Exception say? The error message? But based on your description, there is no error, so it means that the data are inserted into datatabe - but you cannot see the insertions, since this database is attached to your project. Try to write the full path to the … | |
Re: Can you post the code that causes problems in here? thx in advance. | |
Re: Exactly, provide us a code that causes issues to you. Then we can show (explain) what is or might be wrong with it. | |
Re: Do it like: System.IO.DirectoryInfo downloadedMessageInfo = new DirectoryInfo(GetMessageDownloadFolderPath()); foreach (FileInfo file in downloadedMessageInfo.GetFiles()) { file.Delete(); } foreach (DirectoryInfo dir in downloadedMessageInfo.GetDirectories()) { dir.Delete(true); } or: public void DeletingFilesAndFolders(DirectoryInfo directory) { foreach(System.IO.FileInfo file in directory.GetFiles()) file.Delete(); foreach(System.IO.DirectoryInfo subDirectory in directory.GetDirectories()) subDirectory.Delete(true); } | |
Re: As momerath stated, you need differenrt approach then in Console. You need some controls, where you will insert your data (exchange Textbox control for Console.ReadLine() method). Then insert a Label, where yo will show results (exchnage for Console.WriteLine() method). And use same method as you are using now for do … | |
Re: > list item #1 = array(112, Maxwell Smart, MIS) > list item #2 = array(208, Bubba Joe, BNJ) > list item #3 = array(407, Mary Poppins, MEP) Use Linq, and its Extension methods: Example: you add: List<string[]> list = new List<string[]>(); list.Add(new string[] {"112", "Maxwell Smart", "MIS"}); and others... now … | |
Re: I dont get your point. What would you like to do exactly? Tell us the pattern why not adding a Beef as well? | |
Re: Why dont you tell us exactly what is troubling you. You are the one who needs it to be done, not we. And you came with a manner, like we have to correct it, so dont expect from any of us to do the whole code instead of you. We … | |
Re: It clears because cooner or later your code goes to else block, and clears the list. But I actually dont get it which value would you like to put into aux list from lista. Can you clarify it a bit better? -- Do you mean that tin the for loop … | |
Re: Specify them as string and use @ simbol infront of the variable - so the string will be take exactly as it is - no escape characters will be used and add 2 quotations marks on the end to use last quote in the string: Dim myChars As String = … | |
Re: You simply specify the columns name you want to seach by in the WHERE clause, and define it as parameter of the query: DataTable table = new DataTable(); OdbcConnection conn = new OdbcConnection("connString"); string query = @"SELECT * FROM Person WHERE LastName = @last"; OdbcCommand cmd = new OdbcCommand(query, conn); … |
The End.