Auto click after parsing

I asked a question similar to this a while back and one of you helped me arrive at a solution. The same solution isn’t working here. I am scanning in a string to a text box and then parsing it and placing a portion of the said string into a native text box. Once this parsed string lands in the native text box I would like to do a button click programmatically. e.g. button.PerformClick(). Is there a way to effectively do this? I tried doing it on a Text_Changed event but the timing of the button click is inconsistent and usually doesn’t occur at all. I tried using a wait time but that only delays dropping the parsed text into the native text box. Does anyone have an idea?

One way I made this kind of situation work is I built in a “termination character” in my scan to know when the field was finished scanning.

I thought about trying that. I ended up using an EpiViewNotification. It seems to be working well at this point. This is my code.

/************************* class variable ************************/
private EpiDataView edvsnf;

/************************* In InitializeCustomCode() ************************/
this.edvsnf = ((EpiDataView)(this.oTrans.EpiDataViews[“snf”]));
this.edvsnf.EpiViewNotification += new EpiViewNotification(this.edvsnf_EpiViewNotification);

/************************* In DestroyCustomCode() ************************/
this.edvsnf.EpiViewNotification -= new EpiViewNotification(this.edvsnf_EpiViewNotification);
this.edvsnf = null;

private void edvsnf_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
// ** Argument Properties and Uses **
// view.dataView[args.Row][“FieldName”]
// args.Row, args.Column, args.Sender, args.NotifyType
// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
{
if ((args.Row > -1))
{
if((view.dataView[args.Row][“SerialNumber”].ToString().Length > 0) && (!m_bClickedAdd))
{
EpiButton btnAddSN = (EpiButton)csm.GetNativeControlReference(“821b2a75-e1f1-4a8c-a009-d263cccb4d9e”);
btnAddSN.PerformClick();
}
}
}
}

So do you have a “tab” character built in? Or does the scanner auto tab for you?

Also if you add codeblocks around your code it looks prettier:

```cs
code goes in here
```

Yields:

/************************* class variable ************************/
private EpiDataView edvsnf;

/************************* In InitializeCustomCode() ************************/
this.edvsnf = ((EpiDataView)(this.oTrans.EpiDataViews[“snf”]));
this.edvsnf.EpiViewNotification += new EpiViewNotification(this.edvsnf_EpiViewNotification);

/************************* In DestroyCustomCode() ************************/
this.edvsnf.EpiViewNotification -= new EpiViewNotification(this.edvsnf_EpiViewNotification);
this.edvsnf = null;

private void edvsnf_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	// ** Argument Properties and Uses **
	// view.dataView[args.Row][“FieldName”]
	// args.Row, args.Column, args.Sender, args.NotifyType
	// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
	if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
	{
		if ((args.Row > -1))
		{
			if((view.dataView[args.Row][“SerialNumber”].ToString().Length > 0) && (!m_bClickedAdd))
			{
				EpiButton btnAddSN = (EpiButton)csm.GetNativeControlReference(“821b2a75-e1f1-4a8c-a009-d263cccb4d9e”);
				btnAddSN.PerformClick();
			}
		}
	}
}

How about you scan it into a temporary textbox, parse it, moving the parsed pieces to the desired box. This should leave the temp box empty, and use that condition to indicate the parsing is complete. But do it in baby steps

  1. Select the first segment of string to parse
  2. Copy it to the destination control
  3. Back in the temp text box, delete the text you “moved”.

repeat for all segments. When step 3 of the the last segment occurs, the temp box should be empty.

No. Don’t have a tab. This just monitors when the string lands in the text box.