While developing a button, I want the output file generated by the button to have a predefined name consisting in a constant string "PositionalAccuracySamplePoints" and a variable string consisting on the first 15 characters of my gdb Name.
I am new to coding and struggling with understanding what I am doing wrong when trying to call the gdbName variable. I acutally believe that it has to do with the _gdbName value that I define outside the method, that is not getting the substring value that is given inside the method.
private static String _inputGdbPath = ("C:\\Users\\GMartin\\Documents\\Entorno pruebas\\Datos_SEA\\SEA19_0308_07C_20190513.gdb");
public static String _gdbName;
public Salida(String gdbName)
{
GeodatabaseManage gdbManageInput = new GeodatabaseManage(_inputGdbPath);
gdbName = _inputGdbPath;
_gdbName = gdbName.Substring(gdbName.LastIndexOf('\\') + 15);
}
public string fcName = String.Format("PositionalAccuracySamplePoints" + " _ " + "{0}", _gdbName);
With this code I get a NullValueReference exception, as mentioned has to do with the _gdbName of the last line not getting the value of de _gdbName of the inside but the empty value of the String.
Thanks in advance