Smith5646 24 Junior Poster in Training

If you can post what has you stuck, either the code that isn’t working or pseudo code if you’re completely stuck with the language, we can help you out. We are here to help and gladly do, but we will not do the work for you.

Smith5646 24 Junior Poster in Training

The problem with the execution of dank = dankestmemes(); at line 54 is that it is only executed if option is not Y/y. The continue at line 50 when option = Y/y sends the program to check the while condition at line 58, bypassing line 54.

Smith5646 24 Junior Poster in Training

I am guessing (since I don't have tables to verify with) that the problem is that in the below select you have two tables named p, the ledgertable and the result of the select. If I try this with MySQL, I get an error. If you find this is not the problem, I would recommend changing it anyhow because it looks really confusing.

( 
                  SELECT p.trandate,p.voucherno,p.itemno,p.itemname, SUM(isnull(p.recieve,0)) Recieve,
                          SUM(isnull(p.issue,0)) Issue,SUM(isnull(p.returnback,0)) Returnback
                  FROM ledgertable p
                  GROUP BY p.itemno,p.ITEMNAME,p.trandate,p.voucherno) p 
Smith5646 24 Junior Poster in Training

Just to clarify where your error is...

if you find an even number, you are executing a boolean statement (number = even).
if you find an odd number, you are executing a boolean statement (number = odd).

You are never incrementing even or odd. That is what ddanbe is showing you with even++ or even = even +1.

if (number %2==0)
{
    even++;
}
else
{
    odd++;
}

And, to Reverand Jim's point, the bitwise function is more efficient than the mod function but since you are "new to this" you probably haven't stumbed over bitwise functions.

Smith5646 24 Junior Poster in Training

I have written a REST API using C# that runs on my server. When it is started, I want to preload some data from the database based on the organization that has purchased it (name, address, etc). However, I can't seem to figure out the name of the initial program that is called which is normally something like application.cs or program.cs. Can someone provide the name of the initial program or tell me where I can find it?

Smith5646 24 Junior Poster in Training

I am confused with what you are trying to do because your question says you want then number of days REMAINING in the year yet your sample shows days PASSED.

I didn't walk through all of the code you posted but here are a few thoughts on what I'm seeing.

1) As pointed out earlier, you are displaying the value of sum before you calculate it. My guess is you are getting an "uninitialized" value.
2) You are subtracting the year (365) from the day (31, 60, 91, etc.) which is going to give you a negative number in sum. I'm thinking what you really wanted was days - day of month not days - year (by the way, you are using the variable "day" for two different purposes, screen input and calculation and that is a bad idea. Whoever has to support your code later will HATE you for it.).
3) It doesn't look like you are accounting for leap years where every value from month 2 on would be increamented by 1.

Instead of using that big ugly if/else statement, I would put the days in an array and use the month as the index (but maybe you aren't at that point in learning yet). I would also take the rest of the logic (sum calculation and display) out of the if/else and put it at the end so it's only there once.

Hope that helps.

Smith5646 24 Junior Poster in Training

I am trying to find an efficient way to build a cross reference in C# and I am at a loss so I thought I would ask for ideas. I have tried using a list view, concatenating the source and associated values into a single dimension array, and several other things. My problem is the list of source values is dynamic and can be quite large and everything I have tried has had performance issues.

The only requirements I have are
1) It is must be a memory option because I don't have a database in this program.
2) I can't add a source value multiple times.
3) I need to be able to retrieve the associated value later in the program.

So I don't disclose the true nature of my program, I am going to provide a ficticiuos example.
As I read a file, I need to process each letter by first seeing if it is already in the list and if not, add it and the next available number.
"this is sample data" cross references to t=1, h=2, i=3, s=4, a=5, m=6, p=7, l=8, e=9, d=10
Now I also need to be able to search for a letter such as p to retrieve the cross reference value of 7.

I will disclose that the source values are 3 dimensions coordinates (x, y, z) and there can easily be 200K+ values (many of which are duplicates) so sorting and retrieving values is not …

Smith5646 24 Junior Poster in Training

I'm not 100% clear on what you want. If you only care that both textboxes are non blank, can you initially set your button to disabled and then use the following code? When both textboxes have a non blank value, the button is enabled.

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            button1.Enabled = textBox1.Text.Length > 1 && textBox2.Text.Length > 1;
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            button1.Enabled = textBox1.Text.Length > 1 && textBox2.Text.Length > 1;
        }
    }
Smith5646 24 Junior Poster in Training

I don't see a screen print and don't know what you database looks like so maybe some stupid questions but...
1) is book_date a true date field or something else (char or number) with what something that looks like a date?
2) is there a sort defined on the list view that is resequencing the list view after loading?
3) have you debugged to see that you are indeed getting them in the wrong sequence vs something sorting them after the fact?

Smith5646 24 Junior Poster in Training

Let me ask that differently. If I need all of the data at the same time (printing a report for example), for each family, should I create the complicated single JSON string or create multiple JSON strings?

Smith5646 24 Junior Poster in Training

I am trying to find information on best practices for json data. I am working on a client server app that will contain family information. For purposed of this question, this is an oversimplification of the database. I have a family table, an address table, and a family members table. There are also a number of other tables that contain email addresses, phone numbers, etc. For each family, there can be multiple addresses (for the old folks that fly south for the winter), and multiple family members and each family member can have multiple phone numbers and email addresses. The family UID is in each table to enable linking. To retrieve all information for a family, should I build a complex JSON string that contains all of the data that needs to be parsed out manually or should it be individual calls, 1 for the family details, 1 for the addresses, 1 for the family members, 1 for each family members email addresses, and 1 for each family member's phone numbers? The single call seems very complicated but the alternative seems like a lot of overhead with connections, etc.

Smith5646 24 Junior Poster in Training

The quick and 50K ft overview is the app is it is a complicated "family/people tracking system"...names, addresses, phones, emails, etc. A while back, I wrote a version using VB.NET with SqlCe (non-client/server) but now I need a multi-user database because althought we installed the database on a server for sharing, someone forgot to close the program and had everyone else locked out.
I have no intention of allowing "offline" maintenance.
I would like to do the server side with VB.net because that is what I know. Otherwise, I have a learning curve to get to PHP. I know this will limit me to windows servers but anything else adds another learning curve.
I am hesitant to use a web based interface because it seems like there are always issues with which browser and which version of the browser someone is using. I am also very weak with html and css so another learning curve. I was hoping to start with a VB.NET client since most places have at least some windows PCs.
Security will be controlled within the app. Not everyone will have access to everything in the app.

Smith5646 24 Junior Poster in Training

I'm looking for some ideas on a direction to take on a project. I have a software package that I want to develop. When I discussed the software with a potential customer, the first question I got was does it run on a mac? The second question was does it run on an iPad? The third question was how about the web? So, here is where I am looking for ideas. I'm thinking I need to write this as a client server package so the server side handles all the data and validation and the client is "dumb" and only handles the input and output and will be easier to write. I'm looking for suggestions on the data trasnfer mechanism. I'm thinking about using JSON but not sure that is the right direction. I'm also not sure how to do the connection between the client and server because I've not done anything with client / server. Does anyone have any good ideas and maybe knoow of a good website or book that I could use to learn how to write the connection parts?

Smith5646 24 Junior Poster in Training

I am trying to build a webpage that has a list of topics on the left side of the page and then when the user points to them (request has been made for hover and not click), the details of that topic show on the right side of the page.

I have a little experience with HTML from about 10 years ago and am less than a beginner with javascript and CSS. For this adventure, I have fought with the CSS hover function, iframes, and several other ideas but keep running into walls. I'd offer some source to show where I am (I hate posters that want me to do their work for them) but I am still at the how do I do this part. Can someone get me pointed in a good direction on how to do this and give me some sample source or at least keywords to search on to get me started?

As I am typing this I had another thought/question. Does anyone know how "hovering" works on devices like iPads? Is there "hovering" on these types of devices or am I trying to build a page that they won't be able to use?

Thanks in advance.

Smith5646 24 Junior Poster in Training

I am totally lost on this and not sure how to help further. Did you try the other suggestions that I made earlier? What were the results (reply using the question numbers)?

Syntax in the below code will probably need tweeked because I am free typing and not using Studio to edit / verify.

1) Write a block of code to retrieve all rows from the DB and see if the row in question shows up that way.

Dim cmd As New SqlClient.SqlCommand("SELECT * FROM tbl_user", con)
cmd.Connection.Open()
Dim reader As SqlClient.SqlDataReader = cmd.ExecuteReader()
while reader.HasRows
  messagebox.show(reader(1))
end while

2) Do a "select count(*) from tbl_user" to see how many rows it thinks are in the DB.

Dim cmd As New SqlClient.SqlCommand("SELECT count(*) FROM tbl_user", con)
cmd.Connection.Open()
Dim reader As SqlClient.SqlDataReader = cmd.ExecuteReader()
messagebox.show(reader(0))

3) See if the values in the DB have extra spaces or something at the end of them.
Try changing you inserts to be .TEXT.TRIM

4) See if the values in your textboxes have extra spaces or something at the end of them.
Try changing you selects to be .TEXT.TRIM

5) If you have another way to access your DB, see if it returns the row. For example, in visual studio you can "show table data".

Smith5646 24 Junior Poster in Training

I just want an exported copy of the data that I can read. I can't open a .MDF.

Smith5646 24 Junior Poster in Training

I didn't realize the .MDF is SQL server (should have looked at the connection statement closer). Right now I don't have access to a machine with SQL server. Can you export to something such as Access, Excel, .csv?

Smith5646 24 Junior Poster in Training

I'm totally confused now. Can you attach the .MDF file to this thread so I can look at it?

Smith5646 24 Junior Poster in Training

This has me baffled so bear with me for some stupid questions.

If you have 3 records in the DB and then add a 4th record, you say it does not find the 4th record.

If you exit the app and restart, does it find the 4th record?

If you add a 4th and 5th record, does it find the 4th record but not the 5th or does it not find either?

Smith5646 24 Junior Poster in Training

Is your app a window app or command line app? I found this on Microsoft's website.

Command-line applications must have a Sub Main defined. Main must be declared as Public Shared if it is defined in a class, or as Public if defined in a module.

You Main should look like this...

public Shared Sub Main(byVal args() as String)

Smith5646 24 Junior Poster in Training

Now I understand the issue but really don't have a good answer. The code in lines 2 - 17 look right to me.

I am assuming they type into txtUser and txtPass and then click OK which sends them into this sub.

I'm not sure what you are doing with lines 23 and 34 and if they are causing you problems somehow. I doubt it but thought it was worth mentioning.

Here are a couple things to try.
1) Write a quick block of code to retrieve all rows from the DB and see if the row in question shows up that way. You can also do a "select count(*) from tbl_user" to see how many rows it thinks are in the DB. If these work, it has to be something in the select.
2) See if the values in the DB have extra spaces or something at the end of them.
3) See if the values in your textboxes have extra spaces or something at the end of them.
4) If you have another way to access your DB, try doing the select command outside of your program to see if it returns the row.

Let me know what you find and we'll keep narrowing it down.

Smith5646 24 Junior Poster in Training

I use the Mod operator which returns the remainder.

Dim lvi As New ListViewItem
lvi.Text = "Hello"
If ListView1.Items.Count Mod 2 = 0 Then
    lvi.BackColor = Color.white
Else
    lvi.BackColor = Color.LightGray
End If
ListView1.Items.Add(lvi)
Smith5646 24 Junior Poster in Training

The idea of children windows is so that many windows can be open and manipulated at the same time. If you want the app to halt while the child window is open, you should use a dialog box, not a child window.

Smith5646 24 Junior Poster in Training

What is the problem? Is the program blowing up? Is it not returning rows? Is it returning wrong rows?

Smith5646 24 Junior Poster in Training

I still don't understand the issue so let me break down what I think you are telling me and tell me where the issue is.

  • The last row in your database starts with 201112.
  • Current search value is 201201 (YYYYMM) which does not exist in the database.
  • Because there isn't a 201201 record, the If myreader.HasRows is false.
  • When myreader.HasRows is false, strNewID is never assigned a value.
  • Because strNewID is never assigned a value, txtClearanceNo.Text is blank when the form is displayed.

If there are no records for 201201, what do you expect to see in txtClearanceNo? Do you expect the program to display the record from 201112?

Smith5646 24 Junior Poster in Training

I'm still not understanding the issue. Your logic retrieves current year and current month (currently 201201) and then retrieves rows where clearanceno begins with that value. I don't understand what 2011120001 has to do with this as it is in the prior month (201112) and would not be found by your SQL statement. Do you expect to see 2011120001 if there are no rows beginning with 201201? If so, you need to change your SQL to include <=, not just = as in LEFT(clearanceno,6)<=.

Smith5646 24 Junior Poster in Training

I'm not sure what you are asking. Are you saying that you are having a problem where there aren't any records beginning with 201201? If that is the case, I would add an else to the If myreader.HasRows to set strNewID to whatever you want when you don't have records. For example:

If myreader.HasRows Then
    ...current code
Else
    strNewID = strTheID & "0001"
End If
Smith5646 24 Junior Poster in Training

yy returns only the last two digits of the year (12). The variable strTheId in your program = 0112. Try extracting yyyy instead of yy to get 2012 and then concatenate them in the reverse sequence...strYear & strMonth to get 201201.

Smith5646 24 Junior Poster in Training

You are missing some &s for joining strings. "" such as "string1""string2" is translated as string1"string2 and not string1string2

Public urlMySQLDatabase1 As String = "Server=" & frmLogin.txtServerIP.Text & ";" _
        & "Port=" & frmLogin.txtServerPort.Text & ";" _
        & "Database=DatabaseName" & ";" _
        & "Uid=UserID" & ";" _
        & "Pwd=Password" & ";"
Smith5646 24 Junior Poster in Training

Worked great. Thanks.

Smith5646 24 Junior Poster in Training

I have a menustrip with several levels of submenus as in below

Client 1
Project 1
Project 1 Task 1
Project 1 Task 2
Project 2
Project 2 Task 1
Project 2 Task 2

Each entry is clickable, even if it has children. In the above example, I can select the Project 2 menu item.

My problem is that when I hover over Project 2, it automatically expands Project 2 Task 1 and Project 2 Task 2. When I click on Project 2 Task 1, the menu "closes up" and all entries disappear which is what I want. However, when I click Project 2, the menu does not "close up" and all of the entries are still visible.

Is there a way to force the menustrip to close back up?

Smith5646 24 Junior Poster in Training

Try dateTimePicker1.value.hour

Smith5646 24 Junior Poster in Training

I have read your post a number of times and can't figure out what you are asking. Maybe if you can provide additional information someone will be able to answer your request.

Smith5646 24 Junior Poster in Training

One other comment. Since you initialize the .SelectedValue to 0, this works as expected.

Be aware that if you do not initialize it, the value is -1 and trying to retrieve the text when ComboBox.SelectedValue = -1 will blow up.

Smith5646 24 Junior Poster in Training

I think you have a problem with the build of your names array. See if the value of the last entry in it is NOTHING.

Smith5646 24 Junior Poster in Training

Try setting a value for DialogResult in the second form based on the button clicked and then interrogate it in the first form.

Smith5646 24 Junior Poster in Training

Line 28 should be cboStreetName1.Text. .selectedindex.tostring returns the number of the selected index. As a debugging hint, I often use MessageBox.Show to make sure I am getting the value that I am expecting as in MessageBox.Show(cboStreetName1.SelectedIndex.ToString)

I am assuming that you are wrapping lines 22-33 in a SelectedIndexChanged block so it will load the proper values when they select a different street.

Smith5646 24 Junior Poster in Training

Maybe you could use an arraylist (drivers in the example below) instead of 6 different variables (d1 - d6). Then you could do something like this.

If player(x).drivers.Contains("VETTEL") Then
  player(x).score += score.vettel
End If
codeorder commented: quite helpful:) +12
Smith5646 24 Junior Poster in Training

If you haven't already figured this out, you need to copy lines 28 and 29 to just after line 34 so it clears the boxes before adding values. If this doesn't fix the problem, let me know.

Smith5646 24 Junior Poster in Training

I wanted to post a follow up now that I finally got to have a conversation with someone that does this for a living.

Many of his projects in a solution create DLLs that are used used by the EXE. He also explained that if the solution has multiple projects that generate EXEs, even though pressing the F5 to debug will only run the primary EXE, when the solution is published, it will generate multiple EXEs. There is also a way to switch which EXE is primary for debugging purposes but I need to do additional research to find out where to change it.

I hope this additional information helps the next person trying to figure this out.

Smith5646 24 Junior Poster in Training

I'm confused with what you are expecting to see. Do you want the two textboxes to look the same without the first and last line or do you want it in a single line with a space between each value like this...

sadsadasdas dsad as das d

Either way, I think your problem is that lines 19 and 21 are identical. I'm guessing line 21 should include a vbnewline or a space.

TextBox2.Text &= vbnewline & line

or

TextBox2.Text &= " " & line

Smith5646 24 Junior Poster in Training

I am trying to find a good sample license agreement for some software that I have written but can't find anything that meets my requirements.

The software will be tier priced which will be controlled by an authorization key that limits the entries into the database. Since the control is at the DB level, the organization can install the software on as many PCs as they want, give away as many copies as they want, etc.

Also buried in the authorization key is the purchasing organization's name and address which prints on reports, displays on screens, etc. so the sharing of keys between organizations is not likely but I do want to specify that they can't share keys.

The software provides the ability to generate a "free" authorization key which will allow a limited number of entries to the database. Usage of the "free" key is allowed by any organization and there is no time limit (i.e. it is not a trial period). My hopes are that organizations will grow beyond this free limit and have to purchase.

Does anyone know of a good example of an agreement like this or something very similar that I could tweek?

Smith5646 24 Junior Poster in Training

Have a look at MSDN article - Solution (.Sln) File

This tells me how and some benefits, which went right over my head right now, probably because I'm still missing the why. Everything I have built has been one solution / one project. Why would you have multiple projects in one solution and what would be in each of them. Please give details such as the solution was to do xxx, project 1 did yyy and project 2 did zzz.

Smith5646 24 Junior Poster in Training

As I dig deeper into the capabilities of Visual Studio, I have seen that you can have multiple projects in a single solution. I must be missing something because I can't come up with a reason to ever do this? My guess is that I don't understand the benefit. So, I thought I would pose the question to my fellow developers and ask for some real world situations where you had multiple projects in one solution, the benefit obtained, and at a high level, what each project did and why they needed linked into one solution. Also, were they all exes, dlls, etc.?

Thanks in advance for your input.

codeorder commented: interesting topic :) +1
Smith5646 24 Junior Poster in Training

So the "Family x window" and "Family xA window" should both be MDI child windows of the same parent...or did I misunderstand? If so, that is what I have done but it seems like there should be a was to tie "Family xA window" directly to "Family x window" like a parent / child relationship instead of making them equal.

Smith5646 24 Junior Poster in Training

Here are some specifics. The user selects a family to maintenance and a form opens with that family's information (refer to as “Family 1 window”). The user can select a second family and a second form opens with that family's information (refer to as “Family 2 window”). The user can click a button on “Family 1 window” which will open a new window (refer to as "Family 1A window”) where they can enter additional information about Family 1. When this button is clicked, “Family 1 window” should be visible but disabled and “Family 1A window” should be enabled. “Family 2 window” should still be enabled. They should also still be able to open another Family such as Family 3. At this point, “Family 1 window” is visible but disabled, “Family 1A window” is enabled, “Family 2 window” is enabled, “Family 3 window” is enabled. When the user closes “Family 1A window”, “Family 1 window” should be enabled.

So far I have gotten “Family 1A window” to open and “Family 1 window” to disable and “Family 1 window” to enable when “Family 1A window” is closed. However, when “Family 1A window” is displayed and I try to bring “Family 2 window” to the top, “Family 1A window” is still on top of “Family 2 window”.

From my additional testing, it appears that it has something to do the fact that the “Family x window” is an MDI child and “Family xA window” is a normal window and not an …

Smith5646 24 Junior Poster in Training

These seem to be getting me partially there. However, when I click the button on the MDI child window, the MDI child window is disabled and the popup window is displayed as expected. When I attempt to open another MDI child while the popup is still showing, the popup always remains on top (topmost is set to false...I already looked at that) and I can't seem to do anything to get the new MDI child in front of it.

Smith5646 24 Junior Poster in Training

I am working on an app that is an MDI. When the user clicks a button on an MDI child, I want to "disable" the current MDI child (and only the current child window), open a new window that has control, and then re-enable the child window when the new window is closed...very similar to using showDialog().

The thing I an having trouble figuring out is how to allow the other child windows to be active at the same time as when the new window is open. If I use the showDialog(), all child windows are disabled.

Any suggestions on how to do this would be greatly appreciated.

Smith5646 24 Junior Poster in Training

I'm really confused. Please replace line 11 of your original posted code with the following line

If (dateDifference > 7 Or dateDifference < -7) Then

and then in detail tell me what the code is doing step by step, both right and wrong.

For example,

Date entered is more than 7 days in the future...
Line 13 - message is displayed - correct.
Line 15 - form closes - correct.

If the program is still not working after swapping line 11, please repost the current version.

Smith5646 24 Junior Poster in Training

Because I can't see the entire program, I'm confused with what is or isn't working in your code. In your original post, line 11 checks for a date more than 7 days ago. If dateDifference > 7 (date more than 7 days old), the error "Date is out of range" pops up and then the form closes. Is that what it is supposed to do for dates more than 7 days in the future also?