|
You keep saying "I want to update the data via the removable disk" but that doesn't make any sense because the disk itself cannot modify the data as it's not code that runs.
You can store an app on the disk and the user can launch that app, modifying a database that is also stored on that disk, but that's a severe security risk to your database and the people you describe in that database.
What you're doing seems like a really bad idea.
|
|
|
|
|
As the OP allready wrote : he wants to have a sample code.
This answers the unanswered question from Griff too.
The OP has no idea and now he wants to have a (more or less) complete solution.
A long long time ago (long before Networks are usual) I made a similar solution for a friend of mine. Perhapas this is an idea for the OP :
I store each data with a Timestamp, which represents the last modification, on the disk. The storing of the complete data was an action which was selected by the user.
The receiving PC could import the data and replaces each datablock in it's own "collection" with the data from the disk, if it's timestamp is newer.
If the data isn't existing on the PC it was added.
Finally the complete data (with the new timestamp) is written back to the disk so that the 2nd PC could import it. This action was also necessary.
This is the only way (for me) to do something like this if there normally is no connection between both (or more) PC's.
|
|
|
|
|
I'll give you the exact example in C# that you want. My rates are very reasonable.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Exactly the same as if you were using a fixed disk. You need to attach the removable disk, make sure it is writable from your userid, and then just treat it as normal.
|
|
|
|
|
Press eject.
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
|
|
|
|
|
Hi,
I use this class to read XML file and get color information of DataGridView rows.
When I run, compiler says: System.NullReferenceException: 'Object reference not set to an instance of an object.'
My class is:
public static void ReadDataGridViewSettings(System.Windows.Forms.DataGridView dgv)
{
XmlDocument xmldoc = new XmlDocument();
XmlNodeList xmlnode;
FileStream fs = new FileStream(Application.StartupPath + @"\MyGrid.xml", FileMode.Open, FileAccess.Read);
xmldoc.Load(fs);
xmlnode = xmldoc.GetElementsByTagName("Row");
for (int i = 0; i <= dgv.Rows.Count; i++)
{
int cellcolor = int.Parse(xmlnode[i].ChildNodes.Item(0).InnerText.Trim());
int textcolor = int.Parse(xmlnode[i].ChildNodes.Item(1).InnerText.Trim());
if (cellcolor != 0)
{
dgv.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(Convert.ToInt32(cellcolor));
dgv.Rows[i].DefaultCellStyle.ForeColor = Color.FromArgb(Convert.ToInt32(textcolor));
}
else
{
dgv.Rows[i].DefaultCellStyle.BackColor = Color.White;
dgv.Rows[i].DefaultCellStyle.ForeColor = Color.Black;
}
}
fs.Close();
}
My XML file has this structure:
<dataGridView1>
<Row>
<CellColor>-677434</CellColor>
<TextColor>0</TextColor>
</Row>
<Row>
<CellColor>0</CellColor>
<TextColor>0</TextColor>
</Row>
</dataGridView1>
How can I fix it?
|
|
|
|
|
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.
Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which means that there is no instance of a class in the variable.
It's a bit like a pocket: you have a pocket in your shirt, which you use to hold a pen. If you reach into the pocket and find there isn't a pen there, you can't sign your name on a piece of paper - and you will get very funny looks if you try! The empty pocket is giving you a null value (no pen here!) so you can't do anything that you would normally do once you retrieved your pen. Why is it empty? That's the question - it may be that you forgot to pick up your pen when you left the house this morning, or possibly you left the pen in the pocket of yesterday's shirt when you took it off last night.
We can't tell, because we weren't there, and even more importantly, we can't even see your shirt, much less what is in the pocket!
Back to computers, and you have done the same thing, somehow - and we can't see your code, much less run it and find out what contains null when it shouldn't.
But you can - and Visual Studio will help you here. Run your program in the debugger and when it fails, VS will show you the line it found the problem on. You can then start looking at the various parts of it to see what value is null and start looking back through your code to find out why. So put a breakpoint at the beginning of the method containing the error line, and run your program from the start again. This time, VS will stop before the error, and let you examine what is going on by stepping through the code looking at your values.
But we can't do that - we don't have your code, we don't know how to use it if we did have it, we don't have your data. So try it - and see how much information you can find out!
"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!
|
|
|
|
|
Alex Dunlop wrote: compiler says: System.NullReferenceException
The compiler doesn't generate that exception; the runtime does.
If it was a compiler error, you wouldn't be able to run your application at all, because you wouldn't be able to compile it.
Alex Dunlop wrote: new FileStream(Application.StartupPath + @"\MyGrid.xml"
You shouldn't try to write files in the same directory as your application. When it's deployed, it will most likely be stored under the "Program Files" directory, and it would need to run as an admin account to have permission to write to its own directory.
See Where Should I Store My Data?[^] for suggestions of more appropriate locations to save your files.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
What this Exeption generally means is allready explained.
The Mistake you made in your code is the loop. Your limit is i<= DGV.Rows.Count - but it must be i < DGV.Rows.Count. Change that and it could work ...
The Elements from the DGV are from 0...DGV.Rows.Count-1 (because the Collection in it is Zero-based ...
|
|
|
|
|
Thanks. I changed it to
i<=xmlNode.Count-1 and solved. Now, I can retrieve all my color setting in each row.
|
|
|
|
|
You are welcome ...
|
|
|
|
|
I am a student at WGU academy. The school is not bad for what it is considering price and goals. I am going for a bachelors in cybersecurity. I have no background experience in anything I.T. I have only ever been an automotive technician and fire sprinkler installer.
To start at the university, you need to have some prerequisites done at the academy to get accepted. 1 is English composition 101 and the other is Microsoft software development OR Microsoft database administration. I chose software development to learn c#.
On this class, there are 7 topics to pass.
Also on this class, you can access a forum where other students post their problems or solutions on the same course. In that forum, I noticed one of the topics were, "I have finished the 4th topic and still feel I don't know how to code alone without the examples."
With that said, I am on the third topic and am having trouble understanding some of the verbiage and what it means. I have tried Youtube videos and other means. any advice on where to learn better or where can I find better coding practices?
If you guys have any feedback on this school too, let me know.
second topic is all about object oriented programming. I am only having trouble with keywords like, "This", constructors, delegates and signatures.
|
|
|
|
|
You already have this posted in QA: do not post in multiple places - it duplicates work and that wastes our time and annoys people.
"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!
|
|
|
|
|
IMO if you`re new to programming the best way to learn to make programs is to approach two programming languages at the same time (C++ and C# for example) and see the common ground they share (variables, functions, classes), after you have a good grasp of core concepts you can focus on the specifics one particular programming language.
|
|
|
|
|
I'd suspect that will confuse rather than educate - particularly with two languages that look so similar on the surface but are fundamentally different in the way they handle things.
"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!
|
|
|
|
|
There`s little I can teach a veteran.
To my mind if you`re a theory first type person you find it easier to grab a book, learn the basic concepts and dive into applied code afterwards. But there`s also greasy hands first type people(like I am), they throw away the book and go about learning by dismanteling and putting stuff back together.
|
|
|
|
|
What IDE (e.g. Visual Studio) are you using? If VS, press F1 (help) when there's a (selected) keyword you're unsure about ... then read.
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 a book like SAMS Learn C# in 21 Days[^].
The link may not point to the most recent version of the book, so you will have to locate it.
This book series provides a set of lessons that teach you a language, one thing at a time, using live examples and practice coding. It's not going to teach you everything, but you can get a good handle on the language and major concepts. Depending on your level of understanding and how quickly you pick this up, each lesson will probably take 1 to 4 hours. Experienced people breeze through it much faster, but you have a lot of basic concepts to learn.
Unless you have 2 monitors or 2 computers, I recommend hard copy. You don't want to switch back-n-forth between the book and an IDE.
|
|
|
|
|
i am working in a small team and we develop winform application which our company people use it daily. our project is in VSTS means using TFVC.
we use click one publish feature to publish our application to a centralize office server and our colleagues install from there as a result when we give update then those update automatically download in client pc.
please discuss what will be best release management for our winform project. when we check-in any changes in TFVC then all changes goes to main branch that master branch. should we always work with master branch or always create new branch. if new branch then when we should create new branch?
please guide me with steps-by-step details that how could i follow any standard release management for our winform application.
Thanks
|
|
|
|
|
Quote: please guide me with steps-by-step details
Would you like lunch with that?
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
|
|
|
|
|
Oh, yes please.
It's been ages since I went out for lunch.
"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!
|
|
|
|
|
Forum is place where knowledgeable people guide other. i have little knowledge on good strategy for release management and that is why asked here.
|
|
|
|
|
Mou_kol wrote: Forum is place where knowledgeable people guide other And that is perfectly correct - Gerry is just being a smartass (we all do it at some time).
Beware what you ask for, we found the automatic deployment scenario a PITA that needed a lot more care and management than a manual deployment. The senior developer (me) was the one to do/authorise the deployments after discussing/reviewing the changes. As the senior dev I was responsible for the health of the production environment (20+ applications), having my butt kicked for a junior devs stuff up was irritating.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Hi,
I have used DataGridView to my application. I have also added right click menu and some functions such as cell color and text color in it. How can I save cell and text color so when I re-open my application, my last settings to be loaded. I use SQL CE for read/write data from/into DataGridView.
Please guide me.
If possible, please provide a sample code for my question so I can study and find a solution for my own problem.
|
|
|
|