Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I dont Know how to set the border color . if the user enter the wrong keyword then the border shows red color on it. let me know if anyone have this solution for this. I have attached sample image here. Thanks!
sample screenshot
i need exactly same like this.
You can check on button click event using regular expression for Password field and match your both text are same or not.
Code :
public void btnclick(object sender, EventArgs args)
{
if(string.ISNullOrEmpty(entrypassword.text))
{
lblerror1.text = "Password Required";
return;
}
if(string.ISNullOrEmpty(entryconfirmpassword.text))
{
lblerror2.Text = "Confirm Password required";
return;
}
else
{
if(entrypassword.text.length <9)
{
lblerror1.Text = "Password must be 8 characters";
return;
}
if(entrypassword.text != entryconfirmpassword.text)
{
lblerror2.Text = "Passwords are not match";
return;
}
else
{
// your button click code
}
}
}
There is also second option is Triggers of Entry.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 days ago.
Improve this question
Image showing error in vs code
I am following a tutorial video ,in which when he is using "string" as data type it is not showing any error
but when i am using it it shows an error . but when iam using "Var" instead of string the error would go away.
Its because of null safety as var is nullable so you need not to initialize but inacase of string it is not nullable so you need to make it like this
class Deck {
List<Card> cards = [];
}
class Card {
String? suit;
String? rank;
}
//to access use this
void test()
{
Card c = Card();
print(c.suit ?? "unknown suit");
print(c.rank ?? "unknown rank");
}
or alternatively better make a constructor
class Card2{
String suit;
String rank;
Card2(this.suit, this.rank);
}
//use like this
void test2()
{
Card2 c2 = Card2("suit", "9.8");
print(c2.suit);
print(c2.rank);
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have multiple static controls, defined with the SS_NOTIFY style.
How can I discern which control was clicked when I am handling the message with STN_CLICKED?
The documentation tells you:
lParam: Handle to the static control.
The lParam has the HWND of the static control that is sending the notification.
you need assign unique ID to every control. and you got this id back inside wParam when you handle STN_CLICKED notification
for example
switch (uMsg)
{
case WM_COMMAND:
switch (wParam)
{
case MAKEWPARAM(IDC_STATIC_1, STN_CLICKED ):
do_something_1();
break;
case MAKEWPARAM(IDC_STATIC_2, STN_CLICKED ):
do_something_2();
break;
}
break;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Im calling this funcion in many tests. How can i put that in commands.js file and call it where needed
Following Cypress guide. Cypress recommendation is to use commands.js
Documentation link :
[https://docs.cypress.io/api/cypress-api/custom-commands.html#Syntax][1]
You can add CategoryNumber() like this. Go to Support Folder. You will see Command.js
Cypress.Command.add('CategoryNumber, ()=> {
ACTUAL FUNCTION Code
}
How to call?
Go to test definition and call as cy.CategoryNumber()
example function :
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
const domain = Cypress.env('BASE_DOMAIN')
if (domain === '...') {
url = '...' }
if (options.something === 'else') {
url = '...' }
// originalFn is the existing visit command that you need to call
// and it will receive whatever you pass in here. // // make sure
to add a return here! return originalFn(url, options)
})
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am trying to do some stuff onPlayerJoin but nothing is working. I think it is the bukkit problem. How should I do it? My code:
#EventHandler
private void onJoin(PlayerJoinEvent e) {
// Join MSGs
e.setJoinMessage(ChatColor.GOLD + "Hrac " + ChatColor.RED + e.getPlayer().getName() + ChatColor.GOLD + " se pripojil.");
e.setJoinMessage(ChatColor.GOLD + "Hrac " + ChatColor.RED + e.getPlayer().getName() + ChatColor.GOLD + " se odpojil.");
BukkitScheduler scheduler = getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(this, new Runnable() {
#Override
public void run() {
// Teleport every join
Location spawn = (Location) getConfig().get("Spawn");
e.getPlayer().teleport(spawn);
e.getPlayer().sendMessage("teleported to spawn");
// Setting ops
if(getConfig().get("ops") != null ) {
ops = (ArrayList<String>) getConfig().getStringList("ops");
}
for (String o : ops) {
if(e.getPlayer().getName() == o) {
e.getPlayer().setOp(true);
e.getPlayer().sendMessage("op");
}
}
}
}, 20L);
}
There's multiple issues with your code:
You are using the BukkitScheduler.scheduleSyncDelayedTask method instead of the runTaskLater so your task is executed every second instead of one second after the player joined
getServer().getScheduler().runTaskLater(this, new Runnable(){}, 20L);
You are checking if the player is an op by comparing his name with ==, Strings should be compared with the equals method so do this instead
for(String o : ops)
{
if(e.getPlayer().getName().equals(o))
{
//...
}
}
You can't set the join message twice, if you want a multiline join message, send it yourself to all players of the server.
getServer().broadcastMessage("hello");
Hope this helps, good luck with your plugin development
I disagree with what xtrontros said above, you can still use the bukkit scheduler and it seems you have used it well, a delayed task will not repeat.
However when creating locations from config try parsing it instead of casting it. For example:
String[] data = config.getString("spawn").split(",");
Location spawn = new Location(Double.parseDouble(data[0]), Double.parseDouble(data[1]), Double.parseDouble(data[2]), Float.parseFloat(data[3]), Float.parseFloat(data[4]));
Then teleport your players there.
You should also make sure you've registered events in that class, in your onEnable() in your Main class add this
getServer.getPluginManager().registerEvents(new MyClassConstructor(), this)
Or if the event is in your Main class, use this method instead
getServer.getPluginManager().registerEvents(this, this)
Added #Override upto onEnable() method and working now
How can I create a confirm dialog in windows phone 7?
I have an app in which I can delete items, but when someone clicks delete, I want to get him a confirm dialog where they can click 'confirm' or 'abort'
How could I do this?
you can use this:
if(MessageBox.Show("Are you sure?","Delete Item", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
//Delete Sentences
}
Shows a dialog something like this:
Here is the method I use. By the way for a better user experience and for consistencies sake consider using the words "delete" and "cancel" rather than "confirm" or "abort".
public static MessagePromptResult Show(string messageBoxText, string caption, string button1, string button2)
{
int? returned = null;
using (var mre = new System.Threading.ManualResetEvent(false))
{
string[] buttons;
if (button2 == null)
buttons = new string[] { button1 };
else
buttons = new string[] { button1, button2 };
Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(
caption,
messageBoxText,
buttons,
0, // can choose which button has the focus
Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.None, // can play sounds
result =>
{
returned = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(result);
mre.Set(); // could have done it all without blocking
}, null);
mre.WaitOne();
}
if (!returned.HasValue)
return MessagePromptResult.None;
else if (returned == 0)
return MessagePromptResult.Button1;
else if (returned == 1)
return MessagePromptResult.Button2;
else
return MessagePromptResult.None;
}
You will need to add a reference to Microsoft.Xna.Framework.GamerServices to your project.
Rather than asking the user to confirm deletion, have you considered giving the user the ability to "un-delete" items?
While this may be a little bit more work, when it makes sense in teh context of the app it can lead to a much better user experience.
If OK / Cancel is good enough for you, you could stick to the regular MessageBox.Show