Jump to content

madknight3

Member
  • Posts

    1,786
  • Joined

  • Last visited

Everything posted by madknight3

  1. It's simple, sure, but it's also repetitive, time consuming, error prone, and can be automated. They can do whatever they want, I was merely suggesting what I consider to be a better method of including that data in the application. According to Google, there are 195 or 196 countries in the world (depending on whether or not you choose to recognize Taiwan as it's own country). They mention that they have over 20 countries done so far. Which means they have a long way to go. Time saved manually adding information can be spent on other features.
  2. One option is to pass in the required information to form2 through the constructor when you create it ----- form1 ----- private void button1_Click(object sender, EventArgs e) { string tb1 = textBox1.Text; string tb2 = textBox2.Text; //class1 c1 = new class1(); //c1.edit(tb1,tb2); this.Hide(); form2 f2 = new form2(tb1, tb2); f2.Show(); } ----- form2 ----- public form2(string tb1, string tb2) { InitializeComponent(); textbox1.Text = tb1; textbox2.Text = tb2; } This option eliminates the need for class1, though you could put all your data into a class or struct if you want and pass that to form2 as one parameter instead of the two string parameters I used in the above example That could look something like this ----- form1 ----- private void button1_Click(object sender, EventArgs e) { var c1 = new class1 { p1 = textBox1.Text, p2 = textBox2.Text }; // the above is another way to write this //var c1 = new class1(); //c1.p1 = textBox1.Text; //c1.p2 = textBox2.Text; this.Hide(); form2 f2 = new form2(c1); f2.Show(); } ----- form2 ----- public form2(class1 c1) { InitializeComponent(); textbox1.Text = c1.p1; textbox2.Text = c1.p2; } ----- class1 ----- public class class1 { // This is a property. It is basically short hand for those getter/setter methods you created private string _p1; public string p1 { get { return _p1; } // you can add more code in here set { _p1 = value; } // you can add more code in here } // In most cases, you don't need to add any extra code to the getter/setter // So you can also write the above like this. public string p2 { get; set; } }
  3. If the "country" command is going to be in there at all then it sounds like it should be reworked. The idea of manually entering data, like country info, that can be automatically retrieved (from online APIs or downloadable databases) is probably the wrong way of going about it.
  4. The problem is the whitespace in the extension parts of the string openFileDialog1.Filter = "mp4 Files (*.mp4)|*.MP4 | flv files(*.flv)|*.flv "; here^ and here^ You need to remove the whitespace like so openFileDialog1.Filter = "mp4 Files (*.mp4)|*.MP4| flv files(*.flv)|*.flv"; Note that the description portion of the filter string can have spaces, which is the reason that "mp4 Files (*.mp4)" and "flv files(*.flv)" are allowed. It's just the extension portion of the filter string that can't have spaces.
  5. You can't use variables declared inside a block from outside that block. Some examples and explanation of variable scope here. Basically, dgvIdColumn and dgvImageColumn are declared inside the while loop so you can't use them outside the while loop. Therefore moving just the dataGridView1.Columns.Add(...) lines of code outside the while loop are not enough. You'll have to also move the dgvIdColumn and dgvImageColumn code outside the while loop. // Something like this DataGridViewImageColumn dgvImageColumn = new DataGridViewImageColumn(); //set a header text to DataGridView Image Column dgvImageColumn.HeaderText = "Image"; dgvImageColumn.ImageLayout = DataGridViewImageCellLayout.Stretch; DataGridViewTextBoxColumn dgvIdColumn = new DataGridViewTextBoxColumn(); dgvIdColumn.HeaderText = "Id"; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.RowTemplate.Height = 130; dataGridView1.AllowUserToAddRows = false; // add columns to datagridview dataGridView1.Columns.Add(dgvIdColumn); dataGridView1.Columns.Add(dgvImageColumn); SqlConnection con = new SqlConnection(@"Server = .\; Integrated Security = True"); using (SqlCommand cmnd = new SqlCommand("SELECT * FROM [testdb].[dbo].[details]", con)) { con.Open(); SqlDataReader reader1 = cmnd.ExecuteReader(); if (reader1.HasRows) { while (reader1.Read()) { string ID = reader1["ID"].ToString(); string name = reader1["name"].ToString(); string Inam = reader1["Iname"].ToString(); string Fpath = reader1["path"].ToString(); string fullpath = Fpath + Inam;// i have stored image name and image path on 2 different columns in the table of my db. this is to join them Image img1; img1 = Image.FromFile(fullpath); dataGridView1.Rows.Add(name, img1); } } reader1.Close(); }
  6. Coming up with a project that people will actually use isn't easy. So many things have already been built, often multiple times by different people/companies. So coming up with a brand new idea isn't easy and trying to compete with something that already exists may not be easy either. Many people choose to spend their time helping to improve something that already exists, rather than try to build a competing product, but what you do is up to you. If you do want to build something that people will actually use, then you should try to think about who the target user base is for your idea, what they currently use to accomplish things and what's good/bad about those options, how you can make things better for them, etc. It's important that the features you're trying to implement in your project will actually make sense for your target users. After all, you have limited time/resources to spend on a project and you probably don't want to waste time on things that no one is interested in.
  7. Notice that you're adding the columns to the grid view in a while loop. So every time your loop repeats, it will add the columns to the grid view another time.
  8. Sounds like this is for school, in which case he doesn't have a choice and has to use WinForms. Here's an example that shows you how you can fade an image in a picturebox StackOverflow: Fading out an image with transparency in WinForms UI (.NET3.5)
  9. If I understood you correctly, then you have something like the below example where both timers are running in the same form? If this is the case, then timer2 should only need to stop timer1, not call timer1_Tick. Timer1 will call it's own tick event itself. And you don't need to create any sort of object to to access timer1 like you're doing with the Home class. public class Form1 : Form { private void Form1_Load(object sender, EventArgs e) { // Start timer1 and timer2 timer1.Enabled = true; timer2.Enabled = true; // I'm not sure where you start the timers in your code. It could be in the designer properties. // It could be in a button click event. etc. It doesn't really matter so long as they are started at the same time. // I just put the code int the Form Load event for the sake of this example. } private void timer1_Tick(object sender, EventArgs e) { // Move picturebox here } private void timer2_Tick(object sender, EventArgs e) { timer1.Enabled = false; // Will stop timer1. timer2.Enabled = false; // If you also want to stop timer 2 from continuing to run } } Just make sure that each timer is set to the proper interval (50 ms for timer1 and 5000 ms for timer2)
  10. Whether you use a database, csv files, or some other option, you need a way to uniquely identify a student. Given your CSV system, that unique identifier is what you'll need to use for the filename (or at least be part of the filename). If the school gives every student a unique ID number, that's one option for a unique identifier. If they give every student a unique email address, that could be another option. If they give every student a school login, then the username/login id should be unique and that could be another option. If they require the student to register, then they can have the student provide a valid identifier (ex: their own email address, social security number, login id, etc) etc If there's no unique identifier given to students by the school, and you don't get them to provide one, then I suppose you'll have to use a combination of non-unique identifiers that, when combined, give you a unique identifier. You'd still have to enforce that this combination of identifiers is unique though.
  11. There's nothing wrong with learning assembly, and it has its uses, but for most people who are getting into programming, it's a bad first language. It's complicated and it's a poor choice for most programming tasks that they want to do. Maybe it's a good fit for you though, who knows.
  12. Interesting, I haven't heard of that before. Glad someone was able to help you. I also just remembered that services like MacInCloud can also be useful. Figure I'd mention it in case it helps anyone else.
  13. It's been a while since I've done any iOS development (though mine was with Visual Studio, C#, and Xamarin) but unless things have changed (I doubt it), or are different for your platform (I doubt it), you need a mac to build/deploy the app. You don't necessarily have to write your code on the mac but you do need to have one. The mac mini is what most people suggest, given it's the cheapest option (I think). I'm not sure if there are any issues (technical, legal, etc) with using a Virtual Machine, but that could be another option to look into.
  14. Note sure what to tell you then. This opened Chrome fine for me. Start-Process -FilePath 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' Then again, so does this Start-Process -FilePath 'C:\Program Files (x86)\Google\Chrome\Application\chrome' Are you sure your path is completely correct? Note that on my system there's a space before (x86), could you be missing that?
  15. I think you're just missing the .exe at the end of the file path
  16. SQLite is a popular option for this. edit: I misread your question. If your website is just client side then I don't think this will work. Take a look at this: StackOverflow: I need a client side browser database. What are my options edit 2: Actually, it seems like SQLite may actually be possible to use after all. StackOverflow: Is it possible to access an SQLite database from JavaScript?
  17. Visual Basic .NET is also reasonable easy to get into. It doesn't have the best reputation these days though so it's easy to find hate on it. Regardless, it's still got a loyal following despite its reputation. Personally, I don't mind the language that much. I use it quite frequently because it's one of the languages used at the company I work for, but it wouldn't be my first choice. C# is the more popular language to use for the .NET framework. Its extra popularity comes with some perks like more tooling/resources and new features being implemented in C# before VB.NET, however, there's still plenty of stuff out there for VB.NET and you probably won't really notice too much of a difference as a beginner. I tend to recommend C# over VB.NET because of this, but ultimately it doesn't really matter what you choose and you may find VB.NET easier to learn. It's not like you're restricted to only learning one language in your life anyway. I'm not sure what the current state of Visual Studio and .NET are on macOS. It was Windows only for a long time but has been (officially) expanding to other platforms more recently. If you have Windows, it's probably still better to use that but feel free to try using macOS if that's what you prefer. You can download the Visual Studio IDE (ie: the application you'll use to write and run your code) here.
  18. Is this a school project with complexity as a requirement? Normally, it's better to avoid adding complexity for no reason.
  19. As far as I'm aware, Visual Studio doesn't have the functionality you're looking for. This may work for you (I'm not sure because they aren't talking about C++) but it's not really a great solution. I suggest you just get used to the command line window popping up when you run your application.
  20. You know that Java can do more than just build applets, right? You know that a lot of companies use Java, right? You know that no language is the best choice for every situation, right? It's unfortunate that you used the wrong language, or potentially just the wrong project type, for the job but that's hardly a reason to criticise the language from being taught in schools. With that said, many schools are changing, or have already changed, their intro courses away from Java. A lot are choosing Python while some are going with other languages. So there are valid reasons to move away from Java, according to some people, however, yours just isn't one of them.
  21. It's certainly fun to play around with different languages. It's been a while since I've had the time to do that. If I was doing what you're doing, then Rust would be the first language I'd be learning. After that, I'm not sure. Some options I'd consider are Kotlin, Scala, and Clojure (for a JVM alternative to Java, if that ecosystem looks appealing and you even want an alternative) C# and F# (if the .NET ecosystem looks appealing) Typescript, Elm, and Clojurescript (for a JavaScript alternative, if doing web development and you even want an alternative) C++ Python Haskell Elixir Common Lisp (or some other Lisp) Smalltalk Go Julia R Swift You might find the 2017 Stack Overflow Developer Survey useful for seeing what people like/dislike using. The TIOBE index is another site for checking out what's popular which may give you some ideas.
  22. While it's not exactly what you're asking for, there are tools that can generate the constructor code for you so you don't have to write it out yourself (example). You can also create your own generator. More in line with your question, I don't know of an existing solution, but you might be able to create your own solution using reflection. Here are some resources that may or may not help with that. At the very least it should give you an idea of the types of things you would want to search for. http://stackoverflow.com/questions/214086/how-can-you-get-the-names-of-method-parameters http://stackoverflow.com/questions/737151/how-to-get-the-list-of-properties-of-a-class http://stackoverflow.com/questions/619767/set-object-property-using-reflection
  23. If you don't want to do any development for Apple products, then you're better off learning another language. From my understanding, Swift can be used for other platforms, but currently, the options are very limited. If you're not interested in app development, what are you interested in?
  24. If you're interested in web development, try ASP.NET Core. If you're interested in functional programming, try F#. If you're interested in mobile development, try Xamarin. If you're interested in game development, try Unity. If you're looking for project ideas, look here and here. Awesome .NET! and Awesome .NET Core provides you with a large list of libraries, tools, etc for .NET which you may find useful. Pluralsight is one place where you can learn a lot of this stuff. The free Visual Studio Dev Essentials program includes a few free months to Pluralsight. If you're interested in Computer Science, check out OSS University. I'm sure you can find something that interests you out of all that.
×