C
C#2y ago
WolfSHOT

❔ I have an application that changes dns with c#, but it is not working, can you help me?

23 Replies
WolfSHOT
WolfSHOT2y ago
ChatGPT wrote the code
canton7
canton72y ago
What does "it is not working" actually mean, in practice?
WolfSHOT
WolfSHOT2y ago
I don't know either, I'm running the code, but it doesn't change with the dns I specified.
canton7
canton72y ago
Right, so it appears to work, but your dns settings stay the same? Does it show the "DNS servers changed successfully" message box?
WolfSHOT
WolfSHOT2y ago
does not show
canton7
canton72y ago
OK, so one of those if statements isn't matching. Debug your code and find out why
WolfSHOT
WolfSHOT2y ago
I don't know very well, can you explain a little more, what do you think is the problem?
canton7
canton72y ago
Looking at the code, you're not entering that try. So either the foreach loop isn't looping over anything, or the if statement inside it isn't matching (if you did enter the try, you'd show a message box of one sort or another, which isn't happening) So, debug the code. See whether the foreach loop is looping over anything. Look at the conditions in the if, see which one isn't matching. Then work out why.
WolfSHOT
WolfSHOT2y ago
It ends without going inside the foreach loop
canton7
canton72y ago
OK, so find out why objMOC is empty See how we're narrowing down the problem?
WolfSHOT
WolfSHOT2y ago
What do you think objMOC is?
canton7
canton72y ago
Why does my opinion matter, heh? It's right there in your code
Anton
Anton2y ago
$code
MODiX
MODiX2y ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
Anton
Anton2y ago
ime chatgpt gives broken or even straight up wrong code more often than the reverse
WolfSHOT
WolfSHOT2y ago
BlazeBin - kzqlelzrbzwi
A tool for sharing your source code with the world!
WolfSHOT
WolfSHOT2y ago
can you send me an application code that changes dns or a source code
Anton
Anton2y ago
"changes dns" what do you mean by that? the setting in the os?
WolfSHOT
WolfSHOT2y ago
Yeah
WolfSHOT
WolfSHOT2y ago
GitHub
GitHub - Zaczero/DNSChanger: 🔧 The ultimate Windows DNS changer too...
🔧 The ultimate Windows DNS changer tool (with DNSCrypt) - GitHub - Zaczero/DNSChanger: 🔧 The ultimate Windows DNS changer tool (with DNSCrypt)
WolfSHOT
WolfSHOT2y ago
dns changer like
Anton
Anton2y ago
Stack Overflow
How to Change DNS with C# on Windows 10
I'm trying to change the DNS on Windows 10 through VB.NET. I have code that works on Windows 7, however it does not work on Windows 10. Here is my code for Windows 7 that changes the DNS:
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.