Programming in .Net

Status
Not open for further replies.

mqudsi

Mostly Harmless
Staff member
#81
No, it has nothing to do with the Add/Remove Entries window. That's set in the registry.
 

JustinW

Super Moderator
Staff member
#83
Heh. I guess its just there for about forms that load its value onto a label...

What reg subkeys/values would I need to create/modify so it shows up in add/remove programs with the desired effect?
 
Last edited:

mqudsi

Mostly Harmless
Staff member
#84
Have a look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
 

JustinW

Super Moderator
Staff member
#85
So if I built the project the sub keys [xxxx] and required properties are auto-generated? How could one retrieve the sub-key that belongs to that patiular application in code to manipulate its values (like DisplayName, DisplayVersion, etc)?

Edit: I scrolled down lower to see keys with the names of some of the applications I got. What's the purpose of keys like [fdfdfsd-dfsdf...] though for some applications? Security through obscurity?
 
Last edited:

mqudsi

Mostly Harmless
Staff member
#86
It's called a GUID and it's purposely long and random to ensure that no two apps have the same ID which is used by the OS to reference the assembly (so it needs to be unique).

Think of it as your applications' fingerprint.
 

JustinW

Super Moderator
Staff member
#89
Ok, so I might have time in a few weeks so I'm thinking about learning C#. I'm going to reference Techotopia's online book for this though by all means post some other places if you know of any. I think I got a class coming up for it that I might not take if I learn it on my own, but I figure it shouldn't be that difficult because other than getting down the syntax it still uses the same .net namespaces, right?
 

JustinW

Super Moderator
Staff member
#90
Hmm, the first console application shown had this line:

System.Console.WriteLine ("Hello World");

So C# does use 'em. Great :smile:

The online book I'm talking about by the way is here for anyone else looking to take on programming in C#.NET.
 

JustinW

Super Moderator
Staff member
#91
C#'s not as easy to transfer to as I thought. I'm doing a fun little console application that creates two string collections that reference a single array (one for names and one for colors), assigns the string values, and than finally outputs each person's favorite color to the console. I did it first in VB and its working fine:

Module Module1
Public Structure Lists
'Holds a list of strings
Dim ItemsList As System.Collections.Generic.List(Of String)
End Structure

Public Sub Main()
'Create an reference to the Lists structure
Dim NewLists(1) As Lists

'Create two new instances to the List structure and two new
'instances of System.Collections.Generic Lists for the ItemsList
'member of Lists.
NewLists(0) = New Lists 'List of names
NewLists(1) = New Lists 'List of colors
NewLists(0).ItemsList = New System.Collections.Generic.List(Of String)
NewLists(1).ItemsList = New System.Collections.Generic.List(Of String)

'Assign the names to the first list. Assign the favorite colors of
'each person to the second.
NewLists(0).ItemsList.Add("Jim")
NewLists(1).ItemsList.Add("Blue")
NewLists(0).ItemsList.Add("Jack")
NewLists(1).ItemsList.Add("Black")

'Output what color each person likes.
Console.WriteLine(NewLists(0).ItemsList(0) & " likes " & NewLists(1).ItemsList(0))
Console.Write(NewLists(0).ItemsList(1) & " likes " & NewLists(1).ItemsList(1))
Console.Read() 'So I can see the output when debugging

End Sub

End Module
So basically when I run the app, I get two lines:

Jim likes Blue
Jack likes Black

I seem to be having trouble with C# array declarations of a custom type (in my case a structure). Anyone know what I'm doing wrong here? C# version:

using System;
using System.Collections.Generic;
namespace ConsoleApplication2
{
class Program
{
public struct Lists
{
//Holds a list of strings
public List<String> ItemsList;
}
static void Main()
{
//Create two references to the Lists structure
//Error: "; expected"
Lists[2] NewLists;

//Rest of program appears to have been written correctly?...
//Create two new instances to the List structure and two new
//instances of System.Collections.Generic Lists for the ItemsList
//member of Lists.
NewLists[0] = new Lists();
NewLists[1] = new Lists();
NewLists[0].ItemsList = new List<String>();
NewLists[1].ItemsList = new List<String>();

//Assign the names to the first list. Assign the favorite colors of
//each person to the second.
NewLists[0].ItemsList.Add("Jim");
NewLists[1].ItemsList.Add("Blue");
NewLists[0].ItemsList.Add("Jack");
NewLists[1].ItemsList.Add("Black");

//Output what color each person likes.
Console.WriteLine(NewLists[0].ItemsList[0] + " likes " + NewLists[1].ItemsList[0]);
Console.Write(NewLists[0].ItemsList[1] + " likes " + NewLists[1].ItemsList[1]);
Console.Read(); //So I can see the output when debugging

}
}
}

Addendum:


Never mind, found the solution:

Lists[] NewLists;
NewLists = new Lists[2];

OR

Lists[] NewLists = new Lists[2];

Declaration of the array without a size won't give me errors and I dont have to declare a new instace for each new Lists structure individually in C# (can remove the new instance lines for Lists that appear after the declaration thanks to this).

Hopefully this well at least help someone else :smile:
 
Last edited:

Ex_Brit

If you're going through hell, keep going.
Staff member
#92
This thread is 8 years old - locking.
 
Status
Not open for further replies.