|
Maybe, but I don't know how to do that. Using a dropdown for multiple-choice is relatively easy though, maybe that's OK as an alternative?
|
|
|
|
|
Yes. Anything you can host on a form, can be shown inside a dropdown editor.
PropertyGrid and Drop Down properties[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
In a simple web application I have:
TryUserName = Environment.GetEnvironmentVariable("UserName");
LogonServer = Environment.GetEnvironmentVariable("LogonServer");
YourDomainName = Environment.GetEnvironmentVariable("UserDomainName");
During development I have a VPN open to the server which is called NZ-SP-AP1.
On my home machine set gives me:-
Username = Ormond
No LogonServer or UserDomainName.
On the server, logged in as Administrator, set gives me:-
Username = Administrator
LogonServer = \NZ-SP-DC1 (correct)
No UserDomainName.
When I open the web page on the server with the variables in a textbox, I get:-
TryUserName = NZ-SP-AP1$
LogonServer is blank.
UserDomainName is blank.
Does anyone know where it gets these values, particularly the Username?
|
|
|
|
|
|
Anticipating your next question: no, there is no way for a website to obtain these details from a user's computer. If there were, that would be a security vulnerability.
If this is an intranet site, and your users are all part of the same domain/forest as the web server, you might be able to use Windows authentication on your site. Depending on their browser settings, they would either automatically log in as themselves, or have to enter their Windows username and password to log in.
Windows Authentication <windowsAuthentication> | Microsoft Docs[^]
If this is an internet site, where your users are not part of your domain, then you cannot obtain any information about their user account.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
ASP.NET code runs entirely on the server, never on the client or in the browser.
Your code is running on the web server under a service account, so the user information you get back is going to be for the user account the web server is running your code under.
No, there is no way to get the code your wrote to work on the client machine.
|
|
|
|
|
Write program to determine if a given sentence is palindrome or not
User Array-based Stack, and Linked-based Queue in your program.
Class Stack:
Write class Stack using array with the following attributes and methods:
Attribute array (items) of 100 char.
Attribute (top) of type integer.
Constructor (Stack), and initialize (top) to -1.
Method (empty), which returns true if the stack is empty.
Method (push), which takes a character value and push it into the stack.
Method (pop), which returns the last value in (Last-In-First-Out).
Class Node and class Queue:
Write class Node with two attributes; data of type character, and next of type Node. Write a set and get methods for each attribute.
Write class Queue using Linked List with the following attributes and methods:
Attributes (Front and Rear) of type Node.
Constructor (Queue), and initialize all attributes to Null.
Method (empty), which returns true if the queue is empty.
Method (insert), which takes a character value, create object of node, save the character in it, and insert it into the queue.
Method (remove), which returns the first value in (First-In-First-Out).
Palindrome Algorithm in Main:
Create a stack and a queue
Ask user to enter a string
Read string and store it in string s
set variable (pal) of bool to true
Repeat for each character in s:
push s[i] in stack
Insert s[i] in queue
Start new Loop, until stack is empty:
x = stack.pop();
y = queue.remove();
if ( x != y ) set (pal) to false and break from loop
Now, if pal is true then string is "Palindrome", else string is "NOT Palindrome!".
|
|
|
|
|
We don't write code for others; what we will do is help you fix problems in your code. You have everything you need in the text to help you write the code. Good luck.
|
|
|
|
|
Write class Stack using array with the following attributes and methods:
class Stack
{
char items[100];
int top;
Stack()
{
top = -1;
}
}
See how it is not that difficult if you do it one piece at a time? Now you can fill in all the remaining parts.
|
|
|
|
|
The only code you're going to get is the code YOU write.
Begging someone to do your work for you will only result in your ultimate failure in the class.
Writing code is like a fingerprint. It reflects the knowledge and style of the person who wrote it, which will NOT match any piece of code you've turned in to this point. Your teacher will immediately know you didn't write the code.
|
|
|
|
|
No.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Hi guys, how would i do this pattern in c#?
thanks in advance.
modified 11-May-20 14:02pm.
|
|
|
|
|
try
{
Console.WriteLine("#-#-#-#-#");
Console.WriteLine(" #-#-#-# ");
Console.WriteLine(" #-#-# ");
Console.WriteLine(" #-# ");
Console.WriteLine(" # ");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(Convert.ToString(ex));
} You might be tempted to leave out the spaces at the end of the string, but then the pattern is incomplete. All lines should be of equal length, otherwise there is no symmetry. It also needs exception-handling, so I included that in the example. A simple and naive example, I admit, but it works and the output will be technically correct based on your question.
A more complex variation might be done by counting the amount of #. Each line has one fewer # than the previous one, with the - just being filler until you reach the correct amount of #. I'd image that requires some form of loop, counting, and creating a string based on that count.
M.S.S.E wrote: thanks in advance. No problem, glad I could help
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
It's my bad, I'm not that beginner actually,the pattern should be done using for loops, I'm sorry for not mentioning that..
Thank you.
|
|
|
|
|
Message Closed
modified 11-May-20 3:27am.
|
|
|
|
|
Doesn't your textbook provide information about for-loops?
This problem is an obvious example of a homework assignment in an introductory programming course. It is elementary. If you, at the moment, cannot handle this problem by yourself, then go back to your books to learn how to do it. Don't expect to find a for-loop tutor around here. Don't expect to find someone to provide a solution for you to hand in as if it was your work.
You may present your own code, and ask "Why doesn't this work?", and someone may be as kind as to point out where you are wrong. Not by giving you the right answer, but by pointing at what you should check and fix up yourself.
|
|
|
|
|
Use 2 loops and control the shape using them. It's up to you now.
|
|
|
|
|
Think about the pattern in terms of each line.
- zero spaces, followed by 5 hash characters separated by dashes
- one space, followed by 4 hash characters separated by dashes
- two spaces, followed by 3 hash characters separated by dashes
until you get to zero hashes. So the loop should be fairly easy to create and the loop count will help you to calculate how many of each different character to print.
|
|
|
|
|
I was getting error when I was trying it by my self..I will try to apply your concept and post you back the result.
Thank you for your helpful reply.
|
|
|
|
|
What error?
Show us what you got and what error you got, we'll go from there
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Is there a way we can capture explorer.exe clicks(cut/properties/open)in c# using proj.FS
|
|
|
|
|
No because the clicks are sent to the active window. However if you look at using Windows Hooks (Google will find information) it may be possible to do what you want.
|
|
|
|
|
private void button1_Click_1(object sender, EventArgs e)
{
string formCode = "<form id=\"{0}\" name=\"{0}\" method=\"post\" action=\"{1}\">" +
"<input type=\"hidden\" name=\"txntype\" value=\"sale\">" +
"<input type=\"hidden\" name=\"timezone\" value=\"IST\"/>" +
"<input type=\"hidden\" name=\"txndatetime\" value=\"{2}\"/>" +
"<input type=\"hidden\" name=\"hash\" value=\"{3}\"/>" +
"<input type=\"hidden\" name=\"storename\" value=\"{4}\" />" +
"<input type=\"hidden\" name=\"mode\" value=\"payonly\"/>" +
"<input type=\"hidden\" name=\"currency\" value=\"{5}\" />" +
"<input type=\"hidden\" name=\"chargetotal\" value=\"{6}\"/>" +
"<input type=\"hidden\" name=\"language\" value=\"en_EN\"/>" +
"<input type=\"hidden\" name=\"authenticateTransaction\" value=\"true\"/>" +
"</form>";
string formScript = "<script language=\"javascript\" type=\"text/javascript\">" +
"document.getElementById('{0}').submit();" +
"</script>";
string formName = "form1";
string urlString = "https://test.ipg-online.com/connect/gateway/processing";
string storename = this.textBox1.Text;
string txndatetime = DateTime.Now.ToString(@"yyyy\:MM\:dd-HH\:mm\:ss");
string chargetotal = this.textBox2.Text;
string sharedsecret = this.textBox4.Text;
string currency = this.textBox3.Text;
string data = storename + txndatetime + chargetotal + currency + sharedsecret;
string hash = calculateHashFromString(new StringBuilder(data), "SHA1");
string postdata = string.Format(formCode, formName, urlString, txndatetime, hash, storename, currency, chargetotal + formScript + formName);
webBrowser1.Navigate(urlString, postdata);
}
|
|
|
|
|
|
I have a "parent" form in WPF and I would like to add a "child" form of type System.Windows.Forms.Form, which should have its own message pump. I tried the following, but it doesn't compile:
new System.Threading.Thread(delegate ()
{
System.Windows.Forms.Form childFormWithItsOwnMsgPump = new System.Windows.Forms.Form();
System.Windows.Application.Run((System.Windows.Window)childFormWithItsOwnMsgPump);
}).Start();
Does anybody know how to solve it?
|
|
|
|