|
Use Isolated Storage.
Isolated Storage | Microsoft Docs
You can also "roam" isolated storage via One Drive so any device running that app gets synced, if you want.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hello
I have made a maze and want to be able to go to a new level.
I have made the maze and i need it to go to a new form when the mouse enters the label.
Can anybody help me or does anybody know what code can be used to close form one and open form two from entering a label with the mouse?
|
|
|
|
|
Add a MouseEvent, and when it fires then close one form and open the next.
|
|
|
|
|
Ok so when i enter the event i would need to close form1 and open form2
I am a beginer and am just learning. Is this easy code?
|
|
|
|
|
Don't close Form1 - that's likely to be your "startup form" and when that closes your application will automatically be terminated. Your players may get annoyed if they get to the end of a level and the app shuts down ...
Instead of that, consider "reusing" the original form: just clear out the existing maze and draw in your new one - it's the same process you did in the first place to "fill in" your Form1 when the app started, or should be, just with different maze data. You are loading your maze data from a file, I assume?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I made a user control to represent cardboard boxes, probably a bad idea.
The idea is to be able to add a box, like if you have 3 boxes. I was thinking like in Angular, you can make a control array, so it was just natural for me to make a user control.
I placed one on my dialog, and I'm just drawing a blank on how to handle this on the dialog.
Haven't tried anything yet, but did look around and all the examples were for check boxes.
I suppose if I can't make it work, I can re-purpose it to fill a list box, or to fill the box array in my model.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
What do you do with the "boxes"?
In Windows Forms, WPF and UWP there are "wrapping" controls with a .Children collection, that will space out anything you add to them: user controls; buttons; shapes; etc. No "positioning" required.
You attach click / touch / mouse / wheel handlers to these "children" (that you add) to get them to do what you want. (Or you intercept events at the form level if you can determine the target: fewer hooks)
You iterate over the .Children (or a shadow observable collection) if you want to do some group action.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
To assist you, we need to know more about what the "boxes" represent, how they are used, does the user interacts with them at run-time, etc. Do the "boxes": contain other Controls: if so, what are they ?
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Message Closed
modified 28-Oct-20 7:14am.
|
|
|
|
|
No, what Bill is asking for is simpler: UserControl is a special class that allows you teh developer to create a displayable object that shows information to the user and accepts user input - exactly as a TextBox does.
We need to know if the user interacts directly with them (and how if so), how they are used in your app - if you have created the correct object, in fact.
If they are always "internal" to yoru app and are never visible to the user then a UserControl is the wrong choice - a simple class is better as all displayable controls bring a lot of necessary "baggage" with them that a class does not.
If you are trying to show items on a form, then a UserControl is the way to go, but we need to know what you are trying to do with them from a user point of view before we can help you - remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The boxes are literary, well represent card board boxes for shipping. In the user control, you select the item, enter unit cost, how many units, and ship label price. Every shipment has at least one box. You can add boxes, say if your shipment has 4 boxes to ship. So if you have 60 units to ship, and 15 units go in each box, you have 4 boxes.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
So are they pictures of boxes? Do I click on them? Or are they a list of contents plus "add / remove" buttons?
Seriously, we only get exactly what you type to work with here!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
My Bad
It's a rectangle, with 1 combo at the top, then 3 textboxes underneath.
No add / remove buttons, they are at the top of container, outside the user control.
I tried to draw a picture with text, didn't work out.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Right - so it has to be a UserControl, and you need to have an "expanding" collection control to put them on.
I'd probably start with a FlowLayoutPanel - but it depends on how you want to arrange them.
Every time you click the button, it adds another item to it and flows them around to fit:
private void button1_Click(object sender, EventArgs e)
{
Button b = new Button();
b.Text = $"Hello: {++buttonsCount}";
b.Click += MyAddedButton_Click;
myFlowLayoutPanel.Controls.Add(b);
}
private int buttonsCount = 0;
private void MyAddedButton_Click(object sender, EventArgs e)
{
Console.WriteLine((sender as Button)?.Text);
}
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Good call.
I changed the panel to the flow layout panel, went top to bottom.
This is really cool! This panel automatically positions my user control perfect and makes a scroll bar when needed.
I'm in the process of wiring it all up now, so far so good. No different than passing data from a form to a dialog.
You can't see me, but I have a huge smile on my face. And I know I choose the right path.
I'm very happy with .Net Core Win Forms using direct injection, so far it's working great for me. I love using the app I made with this technology.
Thanks Griff!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
You're welcome!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
So I deleted the control off the dialog box, and decided to create the control in code.
This is where I got confused.
I made a panel, set the sizes up static, and wrote some code, where I click on "ADD", and add the user control to the panel.
I did figure out the direct injection part, injecting my inventory repository, and when adding the control the Item list populates.
It's a start at least. Just need to calculate the next box location. I can relate to this, and will test it out and see how it goes before I abandon the idea. Maybe I should be using that Flow Panel control.
private void Btn_Add_Click(object sender, EventArgs e)
{
var ucCount = panelItems.Controls.Count;
var ucLocation = new Point(0, 0);
var shipmentControl = new AmazonFBAShipmentControl(inventoryRepository);
shipmentControl.Location = ucLocation;
panelItems.Controls.Add(shipmentControl);
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I have this query:
var currentYearData = (from p in db.Projects
join co in db.Companies on p.CompanyId equals co.Id
join cty in db.Cities on p.CityId equals cty.Id
join j in db.Jobs on p.Id equals j.ProjectId
join jsdr in db.JobStartDateRevisions on j.Id equals jsdr.JobId
where jsdr.StartDate >= start && jsdr.StartDate <= end
select new { p, c=co, cty, j, jsdr })
.OrderBy(x => x.c.CompanyName)
.ThenBy(x => x.p.ProjectName)
.ThenBy(x => x.jsdr.StartDate)
.ToList();
Where I join on JobStartDateRevisions, I only want to join to the NEWEST JobStartDateRevision record.
Is this possible? Can someone show me how to do this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You don't join on a condition you need to filter the set to get what you want. You could try by ordering the set by StartDate descending and then take 1 record from the top of the set.
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
While Nullable Reference Types are great, in some ways they just kick the problem down the road. In a workflow an object may allow a field to be null in an early step, but mandatory in a later step. I call these Temporal Nulls . If we want our objects to accurately reflect the business case/state NRT's introduce a new design decision. How are you approaching this?
Explainer
In Step 1 I am gathering data. Assume I am not creating the object here, just adding Info data.
In Step 2 I am using the data. At this point Info is required data.
The object is the same object from a business perspective, but from a technology perspective it has two states.
class MyInfo {
public InfoData? Info;
}
class MyInfo {
public InfoData Info;
}
I can think of three general approaches to this.
1. Use multiple classes
2. Use properties or multiple fields
3. Use defaults
The multiple class approach (above) is the most "accurate" but multiplies maintenance and would require different names for the classes (e.g., MyInfo & MyInfoWip).
A property or multiple field approach can look something like this
class MyInfo {
private _infoData?;
public InfoData {
get => _infoData ?? throw ...
set => _infoData = value
}
}
The drawback here is that I've basically exchange a null for an error and I don't know until I try to use it.
The defaults approach is getting common using Empty
class MyInfo {
public InfoData = InfoData.Empty;
public static InfoData Empty => new InfoData();
}
This is just kicking the can. I've replaced a null check with a "Empty Check". It requires defining what Empty values required fields get - new InfoData(emptyValues) .
What other approaches come to mind, and how do you normally deal with Temporal Nulls?
|
|
|
|
|
private string _info = null;
public string Info { get { return _info ?? "I'm empty"; } set { _info = value; } }
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
|
I suggest you look at the new static analysis features/attributes in C# 8: [^]
Quote: AllowNull: A non-nullable input argument may be null.
DisallowNull: A nullable input argument should never be null.
MaybeNull: A non-nullable return value may be null.
NotNull: A nullable return value will never be null.
MaybeNullWhen: A non-nullable input argument may be null when the method returns the specified bool value.
NotNullWhen: A nullable input argument will not be null when the method returns the specified bool value.
NotNullIfNotNull: A return value isn't null if the argument for the specified parameter isn't null.
DoesNotReturn: A method never returns. In other words, it always throws an exception.
DoesNotReturnIf: This method never returns if the associated bool parameter has the specified value. I recommend Jonathan Allen's coverage of these features on InfoQ: >[^]
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 28-Oct-20 5:06am.
|
|
|
|
|
Hi guys
I need your help with developing this program...
Using C# Console application, design a program that uses nested for
loop statements to display students and their respective locations in a string matrix.
|
|
|
|
|
What have you tried? Where are you stuck? What does your code look like right now?
|
|
|
|