|
Hi Nader,
Thanks always for replying.....
Ok, as I understood that I can read the encrypted password from external config file to use in my code, but the problem is, I am using DataSet Designer to design my data tables. And when the application is loaded, the data source is always looking to my App.Config file directly to read the connection string to connect to the SQL Everywhere database. I did not find any way to redirect the data source request to some Code area instead of direct searching in App.Config file.
Thanks and regards
|
|
|
|
|
Hello
Well, You can enjoy all the simplicity of working with the designer -never like it though;)-, and make the adjustments you need.
In the solution explorer, expand the MyDataSet.xsd file -where my dataset is the name of your dataset-, and double click on MyDataSet.Designer.cs.
In that file the connection string is loaded as this
this._connection.ConnectionString = global::MyProjectName.Properties.Settings.Default.MyProjectNameConnectionString;
In this line the program actually loads the ConnectionString from the App config file. This line is repeated several times in several initialization methods. Now my suggestion:
1- Make another encryptor project to encrypt the text of the password and store in the app.config file -you can browse for that-.
2- In the original project's designer file, search for the code I gave you -as I said it's repeated several times-, and write your decryption code after it, so that the connection string in the memory would have the real password.
I hope I didn't confuse you. To conclude:
1- Write an encryptor to encrypt the password -or the whole connection string- in the config file -or an external XML file, it's up to you-.
2- In the designer file, write the code to decrypt the connection string.
3- Make sure you do all this Sh*t after you have finished everything else in your project.
4- If you make changes in the designer all the decryption code you've written will be lost, so make sure to save it somewhere else as a backup.
5- Encrypt the app.config file of your release.
Regards
|
|
|
|
|
Hi Nader,
You are great for providing helps... This is the exact information I was looking for.
Thanks again.
|
|
|
|
|
Hi Nader,
////////////////////////////////////////////////////////////////////////////
This is Emran as I had to sign up another account here with different user name because my previous Hotmail account is not taking any CodeProject Emails.
/////////////////////////////////////////////////////////////////////////////
I wish If I could become an expert like you so that I could also avoid DataSet Designer. But I was wondering what is the future of C# and what is the benifit of learning and learning more on this language as I found C OMEGA is coming to replace C#, and I will have to update myself again with the new language and it is a Race, isn't it !
Regards,
|
|
|
|
|
Hello
it's nice to hear from you again Emran. It's been a while.
bashiwala wrote: I wish If I could become an expert like you so that I could also avoid DataSet Designer
I used the designer when I started out with ADO, and have used it for a while. Yet I didn't like it because it didn't give me the feeling of being in control. So, all I did was going through the code that the designer was writing for me. That's it. Just know what it is doing and do it yourself. Same way with any designer/wizard. Just have the habit of knowing what's behind the scenes, and then if you want control, do it yourself. If you want speed, let the designer do the work for you. You would have a choice then.
bashiwala wrote: I was wondering what is the future of C# and what is the benifit of learning and learning more on this language as I found C OMEGA is coming to replace C#
COmega is not a replacement for C#, rather it's an extension. Whatever you learn in C# will mostly benefit you in COmega. Computer programming actually is a heritage. I didn't become a good C# programmer until I did my homework in Assembly language. Going low level in programming will show you what really happens in your computer's memory. High level programming gives you fancy well organized human friendly code at the cost of performance. Most -including me- of those who help out in the C# forum have C++ backgrounds. I still use C++ for few things that couldn't be accomplished by C#.
Yes you have to keep up in the race and that isn't easy, but try to enjoy it and have fun learning new technologies. but if you really want to be something in that field you got to have some low-level programming experience. Again most of what I've learned in assembly did me a great help in C++ and both helped me greatly while going in C#.
If you don't want all that low-level crap headache, fine. You still can be a good programmer by sticking to C#. it isn't going anywhere soon. COmega is still in research and again, it's just an extension, not a replacement. If you were good in C# holding a grip of COmega won't be an issue.
Regards
|
|
|
|
|
Thanks Nader,
I worked on INTEL 8051, Motorola 68HC12 microcontroller's Assembly language and designed real world hardware applications as I am an Electrical Engineer.
I used to like low level programming before but now I found that, there is no future engaging on that as the race is very fast. Hardware world is never stable and consistent even for 6 months.
So I choosed to become software developer which I found better stable and consistent.
My dream is to establish my own software company, now still a dream
Anyway, thanks for your time again..
Regards.
|
|
|
|
|
You told me before that you are an electric engineer, but I didn't know that you had assembly background. not all electric engineers here in Egypt are interested in the soft part of the game .
Anyway, when I said assembly I meant that which is used with intel microprocessor -Intel 8086 I believe-. The idea is knowing how your program is stored and handled in the memory and on the harddisk. For example. Can you change the system time using C#? Can you access BIOS in C#? Can you get the serial number of a CD disk in C#? These and other tasks sometimes require that you go low-level.
The hardware field is never stable I concur, yet it's kind of biling up instead of totally changing. There are milestones -eg. Pentium technology-, but Pentium4 is very similar in programming to Pentium1 wih the exception of some new instructions. The same assembly that was used in the 80s still work now in 2006 with of course some modifications and adjustments.
In the software programming for example. I love the idea of the Garbage collector taking care of all the things I don't want to be too conserned with, yet that was at the expense of pointers. To use pointers in C# you have to make few unsafe code blocks. So nothing is for free. You were talking about the password hardcoded. As an assembly programmer, fetching that password from the compiled exe file, would be like reading it from a text file. Same thing with MSIL decompilations. Once you get the principle of Reverse engineering of code, you can decompile anything.
Stability is highly unavailable in any of the IT fields. Yet, updating and migrating is much easier than gaining the solid bases of a technology. Depending on what type of programming you are seeking, you should choose what type of languages you learn. If you are thinking about hardware programming for instance, C# -or even COmega-, isn't enough. If you are concerned more about databases, networking, and enterprise programming, stay with C#. It should be good enough, and for sure it's not going to be replaced for a long time.
I wish you success and providence in your company. Dreams come true fast these days. You don't even have to rent an office to make a company. All you need is a website, and some materials to start with.
Regards
|
|
|
|
|
I always appreciate your time that you volunteer to help others. I do believe that, you will get return in rewards for these good attitude and helping mentality.
And thanks for giving me courage.
|
|
|
|
|
I'm always happy to see you on the forum. Again this was just my opinion. I'm looking forward to seeing your company's website. Good luck.
Regards
|
|
|
|
|
Hi
How i can get control by names:
For example i have 3 textbox with name tb0,tb1,tb2
i need to fill them in loop how to do that??
for(int i=0;i<3;i++)
{
TextBox tb=???
}
GOod bye
best regards
when i want to read something good just seat and type it
|
|
|
|
|
Hello
To get a control by name use this.Controls["Controlname"] , like this
for(int i=0;i<3;i++)
{
TextBox tb= (TextBox)this.Controls["tb" + i.ToString()];
}
Yet such a loop doesn't have any error checking. You must make sure that the control is a TextBox using the is or as keywords.
Also if your textbox is in a container -eg. GroupBox-, Then it's inside the controls of that GroupBox not the form, ie.
TextBox tb= (TextBox)this.MyGroupBox.Controls["tb" + i.ToString()];
Regards
|
|
|
|
|
Thank's a lot
when i want to read something good just seat and type it
|
|
|
|
|
//if controls are on form
foreach(Control c in this.Controls)
{
if(c is textbox)
c.Text = "some text";
}
//if controls are in some container
foreach(Control c in this.ContainerName.Controls)
{
if(c is textbox)
c.Text = "some text";
}
i hope it works
ihtesham
|
|
|
|
|
Gee!! Thanks for your reply!
Only one problem is that it wasn't me who asked the question!!;P
He won't get a notification of your reply if you replied to me. Repost your reply by replying to his original post.
Regards
|
|
|
|
|
How can I change my system's Regional options (I want to change it to English-United states and also the datetime/currency formats) using c# code. If any one knows plz reply...urgent
Thanks in advance
Ranjith Stephen
|
|
|
|
|
Hello
I believe it's possible, yet not preferable!! Why, I won't like it at all if i install a program that misses up with my system's configuration. I'd start wondering what else did that program do in my system. Probable, I'd uninstall it immediately and make a system restore.
The real question isn't how. It's why?? Why would you want to do such thing?
My guess is that you are facing some trouble with the Date/Time or currency/numbers formatting, Right-To-Left issues and things like that. Post some details of your real problem, and maybe we can work it out, as changing the system's configuration to suit your formatting isn't the solution.
Regards
|
|
|
|
|
Hii thanx for ur reply. Bu t the thing is that I am modifying an existing appplication. There is a lot of calculations and using a lot of constants ( from ini files and hard coded strings .. etc). Moreover the application will be running in a dedicated system and there is no question of restoring it.
I searched for API s which enables me changing the settings but i couldnt find any
Do you know any ???
thanks and Regards
asdasd
|
|
|
|
|
Hello
You can't change the systems locale perminantly using any API -it would take much more than that to hack into windows restricted settings-. Anyway you can make a workaround it by changing the locale to your app's session only. Check Win APi SetLocaleInfo() function.
Regards
|
|
|
|
|
Hey It is possible..I mean no need to change the systems settings, but the application enviornment as you said .
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US" , true);
will set the application settings into en-US , and our application will work in en-Us format
Thanx
Ranjith Stephen
asdasd
|
|
|
|
|
I mean for example when I use webbrowser control,set the control size 400X300,then navigate the webbrowser to a webpage,and the whole page is displayed in the control,but have scrollbars,so can i scale or shorten the whole page to 400X300.
I hope you know my meanings.
Thanks.
|
|
|
|
|
Hello
I've never seen in before in any browser -this zomming/fit page thing- so I don't think It's avaible directly in the WebBrowser control.
I guess you'd have to make you own Browser object that parses HTML and displays it accordingly. Won't be easy though.
Regards
|
|
|
|
|
Hey everybody !
I'm trying to find a way to get my IP.
I'm pretty sure there is a method for that in the libraries, so I thought maybe someone wouldn't mind to share that information .
Thanks.
|
|
|
|
|
Very simple, Try this:
<br />
IPHostEntry host = Dns.GetHostByName(Dns.GetHostName());<br />
foreach (IPAddress address in host.AddressList) <br />
{<br />
Console.WriteLine("IP Address: {0}", address.ToString());<br />
}<br />
You must include the System.Net namespace as well.
|
|
|
|
|
Thanks
its working perfectly!
by the way, just one more thing, is there a way to tell if the IP I'm getting is the internet IP? (if I have more than one), or do I have to find something (like checking the first number of the IP address)?
|
|
|
|
|
You might check if it's in the valid range of non-network IPs
Alternatively, you could send a HttpWebRequest to http://www.whatismyip.com/
If it succeeds then you can parse the IP. If it does not, you might still want to check method 1
regards
modified 12-Sep-18 21:01pm.
|
|
|
|